diff --git a/.github/workflows/deploy-helm.yml b/.github/workflows/deploy-helm.yml index 17cdd83c..3ab15df9 100644 --- a/.github/workflows/deploy-helm.yml +++ b/.github/workflows/deploy-helm.yml @@ -27,6 +27,8 @@ jobs: - uses: actions/checkout@v4 - name: 'Deploy' run: | + echo "Does not yet work. need to reconfigure TLS, hostname etc" + exit 1 kubecfg_path=${{ runner.temp }}/.kube_config echo "${{ secrets.KUBECONFIG }}" > $kubecfg_path diff --git a/.helm/voluba-prod/Chart.yaml b/.helm/voluba-prod/Chart.yaml index d8bed997..baad33ac 100644 --- a/.helm/voluba-prod/Chart.yaml +++ b/.helm/voluba-prod/Chart.yaml @@ -21,4 +21,4 @@ version: 0.1.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "1.1.2" +appVersion: "1.1.3" diff --git a/frontend/src/const.ts b/frontend/src/const.ts index d36f1b5a..0ed556a3 100644 --- a/frontend/src/const.ts +++ b/frontend/src/const.ts @@ -242,14 +242,20 @@ export type TVolume = { visibility?: 'public' | 'private' | 'custom' | 'useradded' | 'bundled' } -export function expandUrl(url: string): string { - if (/^https?:\/\//.test(url)) { - return url +export function parseGSUrl(url: string): string { + const urlProtocolPattern = /^([^:\/]+):\/\/([^\/]+)((?:\/.*)?)$/ + const match = url.match(urlProtocolPattern) + if (!match) { + throw new Error(`url does not follow the pattern {protocol}://{host}/{path}`) } - if (/^gs:\/\//.test(url)) { - return url.replace(/^gs:\/\//, 'https://storage.googleapis.com/') + const u = {protocol: match[1], host: match[2], path: match[3]}; + + if (u.protocol !== "gs") { + throw new Error(`GS URL must start with gs://, but ${url} does not`) } - throw new Error(`${url} cannot be parsed correctly`) + const path = encodeURIComponent(u.path.substring(1)) + return `https://www.googleapis.com/storage/v1/b/${u.host}/o/${path}?alt=media`; + } const protocol: Record = { diff --git a/frontend/src/state/inputs/selectors.ts b/frontend/src/state/inputs/selectors.ts index da84a64a..47198940 100644 --- a/frontend/src/state/inputs/selectors.ts +++ b/frontend/src/state/inputs/selectors.ts @@ -1,7 +1,7 @@ import { createSelector, select } from '@ngrx/store'; import { nameSpace, LocalState } from './consts'; import { Observable, combineLatest, distinctUntilChanged, forkJoin, from, map, of, pipe, switchMap, throwError } from 'rxjs'; -import { arrayEqual, canBeConverted, cvtToNm, expandUrl, TVolume } from 'src/const'; +import { arrayEqual, canBeConverted, cvtToNm, TVolume, parseGSUrl } from 'src/const'; const featureSelector = (state: any) => state[nameSpace] as LocalState; @@ -67,13 +67,12 @@ const incInfoPipe = pipe( ) } if (!!n5Url) { - const correctedN5Url = expandUrl(n5Url) return forkJoin([ fetch( - `${correctedN5Url}/attributes.json` + parseGSUrl(`${n5Url}/attributes.json`) ).then(res => res.json() as Promise<{ resolution: number[], units: string[] }>), fetch( - `${correctedN5Url}/s0/attributes.json` + parseGSUrl(`${n5Url}/s0/attributes.json`) ).then(res => res.json() as Promise<{ blockSize: number[], dimensions: number[] }>), ]).pipe( map(([root, s0]) => {