mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
fix(layout): escape every bracket and paren in footer package links
String replace() only replaced the first `[`, `]`, `(` and `)`, and link text backslashes were left as is. Use global regexes and escape backslashes too. Fixes CodeQL js/incomplete-sanitization alerts in the tool layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f1b20c7c18
commit
d785329e74
1 file changed
+1
-1
@@ -62,7 +62,7 @@ const toolTitle = computed<string>(() => t(`tools.${i18nKey.value}.title`, Strin
|
||||
const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.description`, String(route.meta.description)));
|
||||
const toolFooter = computed<string>(() => {
|
||||
const createLink = (linkText: string, url: string) => {
|
||||
return `[${linkText.replace('[', '\\[').replace(']', '\\]')}](${url.replace('(', '%28').replace(')', '%29')})`;
|
||||
return `[${linkText.replace(/[\\[\]]/g, '\\$&')}](${url.replace(/\(/g, '%28').replace(/\)/g, '%29')})`;
|
||||
};
|
||||
let footer = t(`tools.${i18nKey.value}.footer`, String(route.meta.footer));
|
||||
if (footer === 'undefined') {
|
||||
|
||||
Reference in new issue
Block a user