mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-18 19:40:03 +08:00
build(runtime): escape % if URI malformed
This commit is contained in:
parent
a56bb562d8
commit
001f2b6c9e
@ -2,6 +2,9 @@ import { defineConfig } from 'vite';
|
|||||||
|
|
||||||
import baseConfig from '../vite.config';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
|
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||||
|
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@ -15,5 +18,15 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/page',
|
outDir: '../dist/page',
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||||
|
sanitizeFileName(name) {
|
||||||
|
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||||
|
const driveLetter = match ? match[0] : '';
|
||||||
|
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,9 @@ import { defineConfig } from 'vite';
|
|||||||
|
|
||||||
import baseConfig from '../vite.config';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
|
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||||
|
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@ -15,5 +18,15 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/playground',
|
outDir: '../dist/playground',
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||||
|
sanitizeFileName(name) {
|
||||||
|
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||||
|
const driveLetter = match ? match[0] : '';
|
||||||
|
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,9 @@ import { defineConfig } from 'vite';
|
|||||||
|
|
||||||
import baseConfig from '../vite.config';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
|
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||||
|
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@ -13,5 +16,15 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/page',
|
outDir: '../dist/page',
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||||
|
sanitizeFileName(name) {
|
||||||
|
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||||
|
const driveLetter = match ? match[0] : '';
|
||||||
|
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,9 @@ import { defineConfig } from 'vite';
|
|||||||
|
|
||||||
import baseConfig from '../vite.config';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
|
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||||
|
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@ -13,5 +16,15 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/playground',
|
outDir: '../dist/playground',
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||||
|
sanitizeFileName(name) {
|
||||||
|
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||||
|
const driveLetter = match ? match[0] : '';
|
||||||
|
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user