Skip to content

Commit

Permalink
refactor(@angular/build): incomplete string escaping or encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 committed Oct 1, 2024
1 parent ef1907f commit 475340a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const MAIN_SERVER_OUTPUT_FILENAME = 'main.server.mjs';
const UNSAFE_CHAR_MAP: Record<string, string> = {
'`': '\\`',
'$': '\\$',
'\\': '\\\\',
};

/**
Expand All @@ -36,7 +37,7 @@ const UNSAFE_CHAR_MAP: Record<string, string> = {
* @returns The escaped string where unsafe characters are replaced.
*/
function escapeUnsafeChars(str: string): string {
return str.replace(/[$`]/g, (c) => UNSAFE_CHAR_MAP[c]);
return str.replace(/[$`\\]/g, (c) => UNSAFE_CHAR_MAP[c]);
}

/**
Expand Down

0 comments on commit 475340a

Please sign in to comment.