From e0f34934f8f46199f067425b380f7fa6bacf70f5 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 15 Sep 2023 17:21:21 +0300 Subject: [PATCH] [MM-54465] Remove lowercase call when checking path names (#2831) (#2834) (cherry picked from commit 128d15a2831137ca10a38529daebb9796afe3a32) Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> --- src/common/Validator.ts | 2 +- src/common/utils/url.test.js | 7 +------ src/common/utils/url.ts | 2 +- src/main/windows/callsWidgetWindow.test.js | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/common/Validator.ts b/src/common/Validator.ts index 385cfd7ea5d..7438074dc9e 100644 --- a/src/common/Validator.ts +++ b/src/common/Validator.ts @@ -201,7 +201,7 @@ export function validateV0ConfigData(data: ConfigV0) { function cleanURL(url: string): string { let updatedURL = url; if (updatedURL.includes('\\')) { - updatedURL = updatedURL.toLowerCase().replace(/\\/gi, '/'); + updatedURL = updatedURL.replace(/\\/gi, '/'); } return updatedURL; } diff --git a/src/common/utils/url.test.js b/src/common/utils/url.test.js index e926a2301ac..2f18a345931 100644 --- a/src/common/utils/url.test.js +++ b/src/common/utils/url.test.js @@ -25,14 +25,9 @@ jest.mock('common/views/View', () => ({ describe('common/utils/url', () => { describe('getFormattedPathName', () => { - it('should format all to lower case', () => { - const unformattedPathName = '/aAbBbB/cC/DdeR/'; - expect(getFormattedPathName(unformattedPathName)).toBe('/aabbbb/cc/dder/'); - }); - it('should add trailing slash', () => { const unformattedPathName = '/aAbBbB/cC/DdeR'; - expect(getFormattedPathName(unformattedPathName)).toBe('/aabbbb/cc/dder/'); + expect(getFormattedPathName(unformattedPathName)).toBe('/aAbBbB/cC/DdeR/'); }); }); describe('parseURL', () => { diff --git a/src/common/utils/url.ts b/src/common/utils/url.ts index 53f7934d5cc..8bed565c0de 100644 --- a/src/common/utils/url.ts +++ b/src/common/utils/url.ts @@ -6,7 +6,7 @@ import {isHttpsUri, isHttpUri, isUri} from 'valid-url'; import buildConfig from 'common/config/buildConfig'; import {customLoginRegexPaths, nonTeamUrlPaths, CALLS_PLUGIN_ID} from 'common/utils/constants'; -export const getFormattedPathName = (pn: string) => (pn.endsWith('/') ? pn.toLowerCase() : `${pn.toLowerCase()}/`); +export const getFormattedPathName = (pn: string) => (pn.endsWith('/') ? pn : `${pn}/`); export const parseURL = (inputURL: string | URL) => { if (inputURL instanceof URL) { return inputURL; diff --git a/src/main/windows/callsWidgetWindow.test.js b/src/main/windows/callsWidgetWindow.test.js index 4bc02dd4a1b..eb400929ed5 100644 --- a/src/main/windows/callsWidgetWindow.test.js +++ b/src/main/windows/callsWidgetWindow.test.js @@ -241,7 +241,7 @@ describe('main/windows/callsWidgetWindow', () => { beforeEach(() => { urlUtils.parseURL.mockImplementation((url) => new URL(url)); urlUtils.getFormattedPathName.mockImplementation((pn) => { - return pn.endsWith('/') ? pn.toLowerCase() : `${pn.toLowerCase()}/`; + return pn.endsWith('/') ? pn : `${pn}/`; }); callsWidgetWindow.options = { callID: 'test-call-id',