diff --git a/package-lock.json b/package-lock.json index bbc6a6989d..2cf037ec42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,6 @@ "jss-rtl": "^0.3.0", "lodash": "^4.17.11", "manifesto.js": "^4.2.0", - "normalize-url": "^4.5.0", "openseadragon": "^2.4.2", "prop-types": "^15.6.2", "re-reselect": "^4.0.0", @@ -11573,15 +11572,6 @@ "node": ">=0.10.0" } }, - "node_modules/normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -23743,11 +23733,6 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, - "normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" - }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", diff --git a/package.json b/package.json index 84b34eb94d..4e4f732456 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "jss-rtl": "^0.3.0", "lodash": "^4.17.11", "manifesto.js": "^4.2.0", - "normalize-url": "^4.5.0", "openseadragon": "^2.4.2", "prop-types": "^15.6.2", "re-reselect": "^4.0.0", diff --git a/src/lib/CanvasWorld.js b/src/lib/CanvasWorld.js index 7df30b0208..bbc62d9548 100644 --- a/src/lib/CanvasWorld.js +++ b/src/lib/CanvasWorld.js @@ -1,4 +1,3 @@ -import normalizeUrl from 'normalize-url'; import MiradorCanvas from './MiradorCanvas'; /** @@ -136,13 +135,10 @@ export default class CanvasWorld { /** Get the IIIF content resource for an image */ contentResource(infoResponseId) { const miradorCanvas = this.canvases.find(c => c.imageServiceIds.some(id => ( - id && infoResponseId && normalizeUrl(id, { stripAuthentication: false }) - === normalizeUrl(infoResponseId, { stripAuthentication: false })))); + id && infoResponseId && (new URL(id).href === new URL(infoResponseId).href)))); if (!miradorCanvas) return undefined; return miradorCanvas.imageResources - .find(r => ( - normalizeUrl(r.getServices()[0].id, { stripAuthentication: false }) - === normalizeUrl(infoResponseId, { stripAuthentication: false }))); + .find(r => (new URL(r.getServices()[0].id).href === new URL(infoResponseId).href)); } /** @private */ diff --git a/src/state/sagas/iiif.js b/src/state/sagas/iiif.js index 3a613ee934..cda18bb5b0 100644 --- a/src/state/sagas/iiif.js +++ b/src/state/sagas/iiif.js @@ -2,7 +2,6 @@ import { all, call, put, select, takeEvery, } from 'redux-saga/effects'; import { Utils } from 'manifesto.js'; -import normalizeUrl from 'normalize-url'; import ActionTypes from '../actions/action-types'; import { receiveManifest, receiveManifestFailure, receiveInfoResponse, @@ -79,8 +78,7 @@ function* fetchIiifResourceWithAuth(url, iiifResource, options, { degraded, fail const id = json['@id'] || json.id; if (response.ok) { - if (normalizeUrl(id, { stripAuthentication: false }) - === normalizeUrl(url.replace(/info\.json$/, ''), { stripAuthentication: false })) { + if (new URL(id).href === new URL(url.replace(/info\.json$/, '').href)) { yield put(success({ json, response, tokenServiceId })); return; }