diff --git a/src/app/core/auth/auth.interceptor.ts b/src/app/core/auth/auth.interceptor.ts index 31de304665..7b9a08de92 100644 --- a/src/app/core/auth/auth.interceptor.ts +++ b/src/app/core/auth/auth.interceptor.ts @@ -102,7 +102,7 @@ export class AuthInterceptor implements HttpInterceptor { private parseLocation(header: string): string { let location = header.trim(); location = location.replace('location="', ''); - location = location.replace('"', ''); + location = location.replace('"', ''); /* lgtm [js/incomplete-sanitization] */ let re = /%3A%2F%2F/g; location = location.replace(re, '://'); re = /%3A/g; diff --git a/src/app/core/shared/metadata.utils.spec.ts b/src/app/core/shared/metadata.utils.spec.ts index ec0b3dd3ba..d9068dd900 100644 --- a/src/app/core/shared/metadata.utils.spec.ts +++ b/src/app/core/shared/metadata.utils.spec.ts @@ -20,6 +20,7 @@ const dcTitle0 = mdValue('Title 0'); const dcTitle1 = mdValue('Title 1'); const dcTitle2 = mdValue('Title 2', 'en_US'); const bar = mdValue('Bar'); +const test = mdValue('Test'); const singleMap = { 'dc.title': [dcTitle0] }; @@ -30,6 +31,10 @@ const multiMap = { 'foo': [bar] }; +const regexTestMap = { + 'foolbar.baz': [test] +}; + const multiViewModelList = [ { key: 'dc.description', ...dcDescription, order: 0 }, { key: 'dc.description.abstract', ...dcAbstract, order: 0 }, @@ -98,6 +103,9 @@ describe('Metadata', () => { testAll([multiMap, singleMap], 'dc.*', [dcDescription, dcAbstract, dcTitle1, dcTitle2]); testAll([multiMap, singleMap], ['dc.title', 'dc.*'], [dcTitle1, dcTitle2, dcDescription, dcAbstract]); }); + describe('with regexTestMap', () => { + testAll(regexTestMap, 'foo.bar.*', []); + }); }); describe('allValues method', () => { diff --git a/src/app/core/shared/metadata.utils.ts b/src/app/core/shared/metadata.utils.ts index 612fba1d4a..6e69109dd7 100644 --- a/src/app/core/shared/metadata.utils.ts +++ b/src/app/core/shared/metadata.utils.ts @@ -156,7 +156,7 @@ export class Metadata { const outputKeys: string[] = []; for (const inputKey of inputKeys) { if (inputKey.includes('*')) { - const inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\.').replace('*', '.*') + '$'); + const inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\\.').replace('*', '.*') + '$'); for (const mapKey of Object.keys(mdMap)) { if (!outputKeys.includes(mapKey) && inputKeyRegex.test(mapKey)) { outputKeys.push(mapKey);