From 337606553cf61730d7f7475d235802387a86c99a Mon Sep 17 00:00:00 2001 From: Robin Goupil Date: Mon, 24 May 2021 16:19:19 +0200 Subject: [PATCH] Fix issue with origin containing a path not finishing with / --- index.tsx | 3 +++ package.json | 3 +-- tsconfig.json | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/index.tsx b/index.tsx index 8df6c9d..051679b 100644 --- a/index.tsx +++ b/index.tsx @@ -37,6 +37,9 @@ export function ReactSRMWrapper({ const [srmMethods, setSrmMethods] = useState(undefined); const initialize = async () => { + if (originUrl && !originUrl.endsWith('/')) { + originUrl += '/'; + } await ResourceFetcherService.loadSRM(originUrl); loaded?.(anchorEl.current!); diff --git a/package.json b/package.json index f9b7664..5ee46dd 100644 --- a/package.json +++ b/package.json @@ -13,13 +13,12 @@ "scripts": { "build": "microbundle-crl --format cjs", "start": "microbundle-crl watch --m --no-compress --format cjs", - "prepare": "run-s build", + "prepare": "run-s build && yarn test && cd example && yarn install && yarn run build", "test": "run-s test:unit test:lint test:build", "test:build": "run-s build", "test:lint": "eslint .", "test:unit": "cross-env CI=1 react-scripts test --env=jsdom", "test:watch": "react-scripts test --env=jsdom", - "predeploy": "cd example && yarn install && yarn run build", "deploy": "gh-pages -d example/build" }, "peerDependencies": { diff --git a/tsconfig.json b/tsconfig.json index 6a41dcf..5235a7e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,13 @@ "noUnusedParameters": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true, - "strict": true + "strict": true, + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "noEmit": true }, "include": [ "."