obsidian-Smart2Brain
obsidian-Smart2Brain copied to clipboard
Please add Chinese support for excluding files and folders
Feature Area
Settings
Painpoint
Exclude files and folders function does not support Chinese
Describe your idea
Make excluded files and folders support Chinese paths
Alternatives
I looked at the source code and guessed that the regular expression of the following function should be causing this problem:
// src/components/Settings/FuzzModal.ts
export function wildTest(wildcard: string, str: string): boolean {
const w = wildcard.replace(/[.+^${}()|[\]\\]/g, '\\$&'); // regexp escape
const re = new RegExp(`\\b${w.replace(/\*/g, '.*').replace(/\?/g, '.')}`, 'i');
return re.test(str);
}
I'm not sure how to debug the plugin, but I guess the following modifications might solve the problem:
export function wildTest(wildcard: string, str: string): boolean {
const w = wildcard.replace(/[.+^${}()|[\]\\]/g, '\\$&'); // regexp escape
const re = new RegExp(`\\b${w.replace(/\*/g, '.*').replace(/\?/g, '.')}`, 'iu'); // 添加 'u' 标志以支持中文
return re.test(str);
}
Additional Context
No response
@nicobrauchtgit