mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
feat(201): add file:// replacement (#280)
* feat: add file:// * feat: add changeset
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
---
|
||||
"@bbob/parser": minor
|
||||
"@bbob/types": minor
|
||||
"@bbob/cli": minor
|
||||
"@bbob/core": minor
|
||||
"@bbob/html": minor
|
||||
"@bbob/plugin-helper": minor
|
||||
"@bbob/preset": minor
|
||||
"@bbob/preset-html5": minor
|
||||
"@bbob/preset-react": minor
|
||||
"@bbob/preset-vue": minor
|
||||
"@bbob/react": minor
|
||||
"@bbob/vue2": minor
|
||||
"@bbob/vue3": minor
|
||||
---
|
||||
|
||||
Now all file protocol urls will be escaped like `file://some/path/to/file` will be converted to `file%3A//some/path/to/file`
|
||||
@@ -54,7 +54,7 @@ function escapeAttrValue(value: string) {
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
// eslint-disable-next-line no-script-url
|
||||
.replace(/(javascript|data|vbscript):/gi, '$1%3A');
|
||||
.replace(/(javascript|data|vbscript|file):/gi, '$1%3A');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,6 +99,11 @@ describe('@bbob/plugin-helper/helpers', () => {
|
||||
href: `JAVASCRIPT:alert('hello')`,
|
||||
})).toBe(` onclick="JAVASCRIPT%3Aalert('hello')" href="JAVASCRIPT%3Aalert('hello')"`)
|
||||
});
|
||||
test(`file:alert("hello")`, () => {
|
||||
expect(attrsToString({
|
||||
href: `file:///shared/customer_info/customer-name`,
|
||||
})).toBe(` href="file%3A///shared/customer_info/customer-name"`)
|
||||
});
|
||||
test(`<tag>`, () => {
|
||||
expect(attrsToString({
|
||||
onclick: `<tag>`,
|
||||
|
||||
Reference in New Issue
Block a user