[MM-54465] Remove lowercase call when checking path names (#2831)

This commit is contained in:
Devin Binnie
2023-09-15 10:20:28 -04:00
committed by GitHub
parent ce1447591d
commit 128d15a283
4 changed files with 4 additions and 9 deletions

View File

@@ -201,7 +201,7 @@ export function validateV0ConfigData(data: ConfigV0) {
function cleanURL(url: string): string { function cleanURL(url: string): string {
let updatedURL = url; let updatedURL = url;
if (updatedURL.includes('\\')) { if (updatedURL.includes('\\')) {
updatedURL = updatedURL.toLowerCase().replace(/\\/gi, '/'); updatedURL = updatedURL.replace(/\\/gi, '/');
} }
return updatedURL; return updatedURL;
} }

View File

@@ -25,14 +25,9 @@ jest.mock('common/views/View', () => ({
describe('common/utils/url', () => { describe('common/utils/url', () => {
describe('getFormattedPathName', () => { 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', () => { it('should add trailing slash', () => {
const unformattedPathName = '/aAbBbB/cC/DdeR'; const unformattedPathName = '/aAbBbB/cC/DdeR';
expect(getFormattedPathName(unformattedPathName)).toBe('/aabbbb/cc/dder/'); expect(getFormattedPathName(unformattedPathName)).toBe('/aAbBbB/cC/DdeR/');
}); });
}); });
describe('parseURL', () => { describe('parseURL', () => {

View File

@@ -6,7 +6,7 @@ import {isHttpsUri, isHttpUri, isUri} from 'valid-url';
import buildConfig from 'common/config/buildConfig'; import buildConfig from 'common/config/buildConfig';
import {customLoginRegexPaths, nonTeamUrlPaths, CALLS_PLUGIN_ID} from 'common/utils/constants'; 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) => { export const parseURL = (inputURL: string | URL) => {
if (inputURL instanceof URL) { if (inputURL instanceof URL) {
return inputURL; return inputURL;

View File

@@ -241,7 +241,7 @@ describe('main/windows/callsWidgetWindow', () => {
beforeEach(() => { beforeEach(() => {
urlUtils.parseURL.mockImplementation((url) => new URL(url)); urlUtils.parseURL.mockImplementation((url) => new URL(url));
urlUtils.getFormattedPathName.mockImplementation((pn) => { urlUtils.getFormattedPathName.mockImplementation((pn) => {
return pn.endsWith('/') ? pn.toLowerCase() : `${pn.toLowerCase()}/`; return pn.endsWith('/') ? pn : `${pn}/`;
}); });
callsWidgetWindow.options = { callsWidgetWindow.options = {
callID: 'test-call-id', callID: 'test-call-id',