diff --git a/.version b/.version index d93847fab5..acbef76955 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.22.1 +2.22.2 diff --git a/frontend/.version b/frontend/.version index d93847fab5..acbef76955 100644 --- a/frontend/.version +++ b/frontend/.version @@ -1 +1 @@ -2.22.1 +2.22.2 diff --git a/frontend/src/_helpers/authorizeWorkspace.js b/frontend/src/_helpers/authorizeWorkspace.js index c3a95564fe..14aeb22c2b 100644 --- a/frontend/src/_helpers/authorizeWorkspace.js +++ b/frontend/src/_helpers/authorizeWorkspace.js @@ -22,7 +22,7 @@ import toast from 'react-hot-toast'; export const authorizeWorkspace = () => { if (!isThisExistedRoute()) { const workspaceIdOrSlug = getWorkspaceIdOrSlugFromURL(); - const isApplicationsPath = getPathname(null, true).includes('/applications/'); + const isApplicationsPath = getPathname(null, true).startsWith('/applications/'); const appId = isApplicationsPath ? getPathname().split('/')[2] : null; /* CASE-1 */ authenticationService diff --git a/frontend/src/_helpers/routes.js b/frontend/src/_helpers/routes.js index 26377022cc..40b98d8057 100644 --- a/frontend/src/_helpers/routes.js +++ b/frontend/src/_helpers/routes.js @@ -119,7 +119,7 @@ export const getWorkspaceIdOrSlugFromURL = () => { }; export const excludeWorkspaceIdFromURL = (pathname) => { - if (!['integrations', 'applications', 'switch-workspace'].find((path) => pathname.includes(path))) { + if (!['/integrations', '/applications/', '/switch-workspace'].find((path) => pathname.startsWith(path))) { pathname = getSubpath() ? pathname.replace(getSubpath(), '') : pathname; const paths = pathname?.split('/').filter((path) => path !== ''); paths.shift(); @@ -132,9 +132,9 @@ export const excludeWorkspaceIdFromURL = (pathname) => { export const getSubpath = () => window?.public_config?.SUB_PATH ? stripTrailingSlash(window?.public_config?.SUB_PATH) : null; -const returnWorkspaceIdIfNeed = (path) => { +export const returnWorkspaceIdIfNeed = (path) => { if (path) { - return !path.includes('applications') && !path.includes('integrations') ? `/${getWorkspaceId()}` : ''; + return !path.startsWith('/applications/') && !path.startsWith('/integrations') ? `/${getWorkspaceId()}` : ''; } return `/${getWorkspaceId()}`; }; diff --git a/frontend/src/_helpers/utils.js b/frontend/src/_helpers/utils.js index 1b8a538d70..c37cfb423d 100644 --- a/frontend/src/_helpers/utils.js +++ b/frontend/src/_helpers/utils.js @@ -9,7 +9,7 @@ import { authenticationService } from '@/_services/authentication.service'; import { useDataQueriesStore } from '@/_stores/dataQueriesStore'; import { getCurrentState } from '@/_stores/currentStateStore'; -import { getWorkspaceIdOrSlugFromURL, getSubpath } from './routes'; +import { getWorkspaceIdOrSlugFromURL, getSubpath, returnWorkspaceIdIfNeed } from './routes'; import { getCookie, eraseCookie } from '@/_helpers/cookie'; import { staticDataSources } from '@/Editor/QueryManager/constants'; @@ -1027,13 +1027,6 @@ export function eraseRedirectUrl() { return redirectPath; } -export const returnWorkspaceIdIfNeed = (path) => { - if (path) { - return !path.includes('applications') && !path.includes('integrations') ? `/${getWorkspaceId()}` : ''; - } - return `/${getWorkspaceId()}`; -}; - export const redirectToWorkspace = () => { const path = eraseRedirectUrl(); const redirectPath = `${returnWorkspaceIdIfNeed(path)}${path && path !== '/' ? path : ''}`; diff --git a/server/.version b/server/.version index d93847fab5..acbef76955 100644 --- a/server/.version +++ b/server/.version @@ -1 +1 @@ -2.22.1 +2.22.2