diff --git a/packages/dashboard-frontend/src/services/helpers/location.ts b/packages/dashboard-frontend/src/services/helpers/location.ts index 3f939f8f1..99727893d 100644 --- a/packages/dashboard-frontend/src/services/helpers/location.ts +++ b/packages/dashboard-frontend/src/services/helpers/location.ts @@ -48,6 +48,16 @@ export function buildFactoryLoaderLocation(url?: string): Location { editor = editorParam.slice(); } fullUrl.searchParams.delete('che-editor'); + + // search for devfile switch and if there is one, remove it from the URL + const devfileFilenameAttribute = 'devfileFilename'; + const devfileFilenameParam = fullUrl.searchParams.get(devfileFilenameAttribute); + let devfileFilename; + if (devfileFilenameParam && typeof(devfileFilenameParam) === 'string') { + devfileFilename = devfileFilenameParam.slice(); + } + fullUrl.searchParams.delete(devfileFilenameAttribute); + const encodedUrl = encodeURIComponent(fullUrl.toString()); // if editor specified, add it as a new parameter @@ -55,6 +65,9 @@ export function buildFactoryLoaderLocation(url?: string): Location { if (editor) { pathAndQuery = `${pathAndQuery}&che-editor=${editor}`; } + if (devfileFilename) { + pathAndQuery = `${pathAndQuery}&override.devfileFilename=${devfileFilename}`; + } } return _buildLocationObject(pathAndQuery); }