mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
fix(electron): filename escape (#9583)
This commit is contained in:
@@ -44,8 +44,9 @@ export function escapeFilename(name: string) {
|
|||||||
// replace all special characters with '_' and replace repeated '_' with a single '_' and remove trailing '_'
|
// replace all special characters with '_' and replace repeated '_' with a single '_' and remove trailing '_'
|
||||||
return name
|
return name
|
||||||
.replaceAll(/[\\/!@#$%^&*()+~`"':;,?<>|]/g, '_')
|
.replaceAll(/[\\/!@#$%^&*()+~`"':;,?<>|]/g, '_')
|
||||||
.replaceAll(/_+/g, '_')
|
.split('_')
|
||||||
.replace(/_+$/, '');
|
.filter(Boolean)
|
||||||
|
.join('_');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSpaceDBPath(
|
export async function getSpaceDBPath(
|
||||||
|
|||||||
Reference in New Issue
Block a user