[arvados-workbench2] created: 2.4.0-181-g98d3f770
git repository hosting
git at public.arvados.org
Thu Aug 25 14:30:22 UTC 2022
at 98d3f7708860701b02055643da4ba9412720bf4b (commit)
commit 98d3f7708860701b02055643da4ba9412720bf4b
Author: Stephen Smith <stephen at curii.com>
Date: Thu Aug 25 10:29:42 2022 -0400
19421: Redirect old "redirectTo" url param to "redirectToPreview"
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/src/common/redirect-to.ts b/src/common/redirect-to.ts
index d8fecde4..73c94843 100644
--- a/src/common/redirect-to.ts
+++ b/src/common/redirect-to.ts
@@ -7,6 +7,7 @@ import { Config } from './config';
export const REDIRECT_TO_DOWNLOAD_KEY = 'redirectToDownload';
export const REDIRECT_TO_PREVIEW_KEY = 'redirectToPreview';
+export const REDIRECT_TO_KEY = 'redirectTo';
const getRedirectKeyFromUrl = (href: string): string | null => {
switch (true) {
@@ -14,6 +15,8 @@ const getRedirectKeyFromUrl = (href: string): string | null => {
return REDIRECT_TO_DOWNLOAD_KEY;
case href.indexOf(REDIRECT_TO_PREVIEW_KEY) > -1:
return REDIRECT_TO_PREVIEW_KEY;
+ case href.indexOf(`${REDIRECT_TO_KEY}=`) > -1:
+ return REDIRECT_TO_KEY;
default:
return null;
}
@@ -32,8 +35,11 @@ export const storeRedirects = () => {
const { location: { href }, localStorage } = window;
const redirectKey = getRedirectKeyFromUrl(href);
- if (localStorage && redirectKey) {
- localStorage.setItem(redirectKey, href.split(`${redirectKey}=`)[1]);
+ // Change old redirectTo -> redirectToPreview when storing redirect
+ const redirectStoreKey = redirectKey === REDIRECT_TO_KEY ? REDIRECT_TO_PREVIEW_KEY : redirectKey;
+
+ if (localStorage && redirectKey && redirectStoreKey) {
+ localStorage.setItem(redirectStoreKey, href.split(`${redirectKey}=`)[1]);
}
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list