From 2103cc27235900efa3b6310890b75f092d3bf961 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Fri, 24 Jan 2020 08:54:30 +0100 Subject: [PATCH] fix trailing slash issue --- .github/workflows/e2e.yml | 3 +-- e2e/src/iv.e2e-spec.js | 2 +- src/atlasViewer/atlasViewer.constantService.service.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7e4fb7aa5..e8f8aed0c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -11,7 +11,7 @@ env: DOCKER_CONTAINER_NAME: gha-iav-built-${{ github.sha }} DOCKER_E2E_PPTR: gha-iav-e2e-pptr-${{ github.sha }} DOCKER_E2E_NETWORK: gha-dkr-network-${{ github.sha }} - ATLAS_URL: http://gha-iav-built-${{ github.sha }}:3000 + ATLAS_URL: http://gha-iav-built-${{ github.sha }}:3000/ jobs: buildimage: @@ -38,7 +38,6 @@ jobs: docker run \ --rm \ --name ${DOCKER_CONTAINER_NAME} \ - -p 13000:3000 \ --env HBP_CLIENTID=${{ secrets.HBP_CLIENTID }} \ --env HBP_CLIENTSECRET=${{ secrets.HBP_CLIENTSECRET }} \ --env REFRESH_TOKEN=${{ secrets.REFRESH_TOKEN }} \ diff --git a/e2e/src/iv.e2e-spec.js b/e2e/src/iv.e2e-spec.js index be4f07158..79f2d1ae6 100644 --- a/e2e/src/iv.e2e-spec.js +++ b/e2e/src/iv.e2e-spec.js @@ -13,7 +13,7 @@ describe('protractor works', () => { }) const pptr = require('puppeteer') -const ATLAS_URL = process.env.ATLAS_URL || 'http://localhost:3000' +const ATLAS_URL = (process.env.ATLAS_URL || 'http://localhost:3000').replace(/\/$/, '') if (ATLAS_URL.length === 0) throw new Error(`ATLAS_URL must either be left unset or defined.`) if (ATLAS_URL[ATLAS_URL.length - 1] === '/') throw new Error(`ATLAS_URL should not trail with a slash: ${ATLAS_URL}`) diff --git a/src/atlasViewer/atlasViewer.constantService.service.ts b/src/atlasViewer/atlasViewer.constantService.service.ts index 04a9f0f21..ac6978fb9 100644 --- a/src/atlasViewer/atlasViewer.constantService.service.ts +++ b/src/atlasViewer/atlasViewer.constantService.service.ts @@ -52,7 +52,7 @@ export class AtlasViewerConstantsServices implements OnDestroy { } // instead of using window.location.href, which includes query param etc - public backendUrl = BACKEND_URL || `${window.location.origin}${window.location.pathname}` + public backendUrl = `${BACKEND_URL}/`.replace(/\/\/$/, '\/') || `${window.location.origin}${window.location.pathname}` private fetchTemplate = (templateUrl) => this.http.get(`${this.backendUrl}${templateUrl}`, { responseType: 'json' }).pipe( switchMap((template: any) => { -- GitLab