[MM-54465] Remove lowercase call when checking path names (#2831)
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -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', () => {
|
||||||
|
@@ -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;
|
||||||
|
@@ -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',
|
||||||
|
Reference in New Issue
Block a user