[DURACOM-344] refactor solution to avoid double slashes

This commit is contained in:
FrancescoMolinaro
2025-05-12 17:34:07 +02:00
parent 4c9638150a
commit c442d35505
6 changed files with 77 additions and 45 deletions

View File

@@ -58,6 +58,7 @@ import {
REQUEST,
RESPONSE,
} from './src/express.tokens';
import { SsrExcludePatterns } from "./src/config/ssr-config.interface";
/*
* Set path for the browser application's dist folder
@@ -633,9 +634,11 @@ function start() {
* @param path
* @param excludePathPattern
*/
function isExcludedFromSsr(path: string, excludePathPattern: (string | RegExp)[]): boolean {
return excludePathPattern.some((pattern) => {
const regex = new RegExp(pattern);
function isExcludedFromSsr(path: string, excludePathPattern: SsrExcludePatterns[]): boolean {
const patterns = excludePathPattern.map(p =>
new RegExp(p.pattern, p.flag || '')
);
return patterns.some((regex) => {
return regex.test(path)
});
}