From b80e84b43833c3a190bf3b23e2780528a818f7f8 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Thu, 26 Jan 2023 16:34:42 +0200 Subject: [PATCH] Revert "formatApiPath / formatAssetPath - Implement smart functionality to detect double subpath" (#3001) Reverts Unleash/unleash#2777 --- frontend/src/utils/formatPath.test.ts | 2 -- frontend/src/utils/formatPath.ts | 9 +-------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/frontend/src/utils/formatPath.test.ts b/frontend/src/utils/formatPath.test.ts index aa64ea7367..63b4668c98 100644 --- a/frontend/src/utils/formatPath.test.ts +++ b/frontend/src/utils/formatPath.test.ts @@ -28,7 +28,6 @@ test('formatAssetPath', () => { expect(formatAssetPath('/a', '/x')).toEqual('/x/a'); expect(formatAssetPath('/a/', '/x/')).toEqual('/x/a'); expect(formatAssetPath('a/b/', 'x/y/')).toEqual('/x/y/a/b'); - expect(formatAssetPath('x/y/', 'x/y/')).toEqual('/x/y'); expect(formatAssetPath('//a//b//', '//x//y//')).toEqual('/x/y/a/b'); }); @@ -43,7 +42,6 @@ test('formatApiPath', () => { expect(formatApiPath('/', '/')).toEqual(''); expect(formatApiPath('a', 'x')).toEqual('/x/a'); expect(formatApiPath('/a', '/x')).toEqual('/x/a'); - expect(formatApiPath('/a', '/x/a')).toEqual('/x/a'); expect(formatApiPath('/a/', '/x/')).toEqual('/x/a'); expect(formatApiPath('a/b/', 'x/y/')).toEqual('/x/y/a/b'); expect(formatApiPath('//a//b//', '//x//y//')).toEqual('/x/y/a/b'); diff --git a/frontend/src/utils/formatPath.ts b/frontend/src/utils/formatPath.ts index 62f94ec852..fed18ba181 100644 --- a/frontend/src/utils/formatPath.ts +++ b/frontend/src/utils/formatPath.ts @@ -23,14 +23,7 @@ export const parseBasePath = (value = basePathMetaTagContent()): string => { // Join paths with a leading separator and without a trailing separator. const joinPaths = (...paths: string[]): string => { - const filteredPaths = paths.filter(path => { - return !paths.some( - currentPath => currentPath !== path && currentPath.includes(path) - ); - }); - const uniquePaths = [...new Set(filteredPaths)]; - - return ['', ...uniquePaths] + return ['', ...paths] .join('/') .replace(/\/+$/g, '') // Remove trailing separators. .replace(/\/+/g, '/'); // Collapse repeated separators.