Skip to content

Commit 89c615b

Browse files
committed
Use the URL api rather than normalize-url
The URL API is now in all browsers that we support: https://caniuse.com/url
1 parent 6150c0a commit 89c615b

4 files changed

Lines changed: 3 additions & 25 deletions

File tree

package-lock.json

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"jss-rtl": "^0.3.0",
4949
"lodash": "^4.17.11",
5050
"manifesto.js": "^4.2.0",
51-
"normalize-url": "^4.5.0",
5251
"openseadragon": "^2.4.2",
5352
"prop-types": "^15.6.2",
5453
"re-reselect": "^4.0.0",

src/lib/CanvasWorld.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import normalizeUrl from 'normalize-url';
21
import MiradorCanvas from './MiradorCanvas';
32

43
/**
@@ -136,13 +135,10 @@ export default class CanvasWorld {
136135
/** Get the IIIF content resource for an image */
137136
contentResource(infoResponseId) {
138137
const miradorCanvas = this.canvases.find(c => c.imageServiceIds.some(id => (
139-
id && infoResponseId && normalizeUrl(id, { stripAuthentication: false })
140-
=== normalizeUrl(infoResponseId, { stripAuthentication: false }))));
138+
id && infoResponseId && (new URL(id).href === new URL(infoResponseId).href))));
141139
if (!miradorCanvas) return undefined;
142140
return miradorCanvas.imageResources
143-
.find(r => (
144-
normalizeUrl(r.getServices()[0].id, { stripAuthentication: false })
145-
=== normalizeUrl(infoResponseId, { stripAuthentication: false })));
141+
.find(r => (new URL(r.getServices()[0].id).href === new URL(infoResponseId).href));
146142
}
147143

148144
/** @private */

src/state/sagas/iiif.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
all, call, put, select, takeEvery,
33
} from 'redux-saga/effects';
44
import { Utils } from 'manifesto.js';
5-
import normalizeUrl from 'normalize-url';
65
import ActionTypes from '../actions/action-types';
76
import {
87
receiveManifest, receiveManifestFailure, receiveInfoResponse,
@@ -79,8 +78,7 @@ function* fetchIiifResourceWithAuth(url, iiifResource, options, { degraded, fail
7978

8079
const id = json['@id'] || json.id;
8180
if (response.ok) {
82-
if (normalizeUrl(id, { stripAuthentication: false })
83-
=== normalizeUrl(url.replace(/info\.json$/, ''), { stripAuthentication: false })) {
81+
if (new URL(id).href === new URL(url.replace(/info\.json$/, '').href)) {
8482
yield put(success({ json, response, tokenServiceId }));
8583
return;
8684
}

0 commit comments

Comments
 (0)