Skip to content
Snippets Groups Projects
Commit a98f1f1a authored by Jack Reed's avatar Jack Reed
Browse files

Fixes #1943 by removing unnecessary trailing slashes

Manifesto seems to return trailing slashes for v1 Image API resources.
This change makes our use of this consistent.
parent 2d30d6ba
No related branches found
No related tags found
No related merge requests found
{
"@id": "https://manifests.britishart.yale.edu/Osbornfa1",
"@type": "sc:Manifest",
"description": "Osborn fa1 IIIF Manifest created for the Digitally Enabled Scholarship with Medieval Manuscripts project at Yale University.",
"label": "New Haven, Beinecke Rare Book and Manuscript Library, Yale University, Osborn fa1",
"sequences": [
{
"@id": "https://manifests.britishart.yale.edu/sequence/Osbornfa1",
"@type": "sc:Sequence",
"canvases": [
{
"@id": "http://scale.ydc2.yale.edu/canvas/684c8053-0247-45a2-b55d-10dd3defebe4",
"@type": "sc:Canvas",
"height": 4438,
"images": [
{
"@id": "http://scale.ydc2.yale.edu/annotation/b38081da-8991-4464-a71e-d9891226a35f",
"@type": "oa:Annotation",
"motivation": "sc:painting",
"on": "http://scale.ydc2.yale.edu/canvas/684c8053-0247-45a2-b55d-10dd3defebe4",
"resource": {
"@id": "https://images.britishart.yale.edu/iiif/b38081da-8991-4464-a71e-d9891226a35f/full/full/0/native.jpg",
"@type": "dctypes:Image",
"format": "image/jpeg",
"height": 4438,
"label": "Osborn fa1, [Bookplates]",
"service": {
"@id": "https://images.britishart.yale.edu/iiif/b38081da-8991-4464-a71e-d9891226a35f/",
"profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",
"@context": "http://iiif.io/api/image/1/context.json"
},
"width": 3603
}
}
],
"label": "Osborn fa1, [Bookplates]",
"width": 3603
}
]
}
]
}
import manifesto from 'manifesto.js'; import manifesto from 'manifesto.js';
import ManifestoCanvas from '../../../src/lib/ManifestoCanvas'; import ManifestoCanvas from '../../../src/lib/ManifestoCanvas';
import fixture from '../../fixtures/version-2/019.json'; import fixture from '../../fixtures/version-2/019.json';
import imagev1Fixture from '../../fixtures/version-2/Osbornfa1.json';
describe('ManifestoCanvas', () => { describe('ManifestoCanvas', () => {
let instance; let instance;
...@@ -16,6 +17,17 @@ describe('ManifestoCanvas', () => { ...@@ -16,6 +17,17 @@ describe('ManifestoCanvas', () => {
); );
}); });
}); });
describe('imageInformationUri', () => {
it('correctly returns an image information url for a v2 Image API', () => {
expect(instance.imageInformationUri).toEqual('https://stacks.stanford.edu/image/iiif/hg676jb4964%2F0380_796-44/info.json');
});
it('correctly returns an image information url for a v1 Image API', () => {
const imagev1Instance = new ManifestoCanvas(
manifesto.create(imagev1Fixture).getSequences()[0].getCanvases()[0],
);
expect(imagev1Instance.imageInformationUri).toEqual('https://images.britishart.yale.edu/iiif/b38081da-8991-4464-a71e-d9891226a35f/info.json');
});
});
describe('aspectRatio', () => { describe('aspectRatio', () => {
it('calculates a width / height aspectRatio', () => { it('calculates a width / height aspectRatio', () => {
expect(instance.aspectRatio).toBeCloseTo(0.667); expect(instance.aspectRatio).toBeCloseTo(0.667);
......
...@@ -25,7 +25,9 @@ export default class ManifestoCanvas { ...@@ -25,7 +25,9 @@ export default class ManifestoCanvas {
/** /**
*/ */
get imageInformationUri() { get imageInformationUri() {
return `${this.canvas.getImages()[0].getResource().getServices()[0].id}/info.json`; return `${
this.canvas.getImages()[0].getResource().getServices()[0].id.replace(/\/$/, '')
}/info.json`;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment