When tauri tries to add a path the filesystem scope, if that path has an unmatched square open bracket in it, ([a.txt) the filesystem scope gets corrupted, rendering most or all fs plugin methods useless. If the persisted-scope plugin is installed, this will persist even when the app restarts. This happens with paths selected with dialog.open or if the user drag and drops a badly named file into a tauri window, even if no drag and drop event listener is registered.
Deleting $APPLOCALDATA/.persisted-scope fixes this, but does lose persisted scope info.
Either drag and drop a file with an unmatched open bracket in the path into the window, or selected one with in the dialog when clicking the "Click Me" button.
Any time you select any file after that, you will see something like
path: /some/path/which/may/or/may/not/have/brackets
msg:
error: "invalid glob pattern: Pattern syntax error near position 11: invalid range pattern"
Expected behavior
Paths with unmatched open brackets are usable
Even if not, they don't permanently corrupt the scope
There seems to be no way to guard against this because both drag and drop and dialog open attempt to add the path to the scope immediately, so you cannot inspect the path and reject it.
Describe the bug
When tauri tries to add a path the filesystem scope, if that path has an unmatched square open bracket in it, (
[a.txt
) the filesystem scope gets corrupted, rendering most or all fs plugin methods useless. If the persisted-scope plugin is installed, this will persist even when the app restarts. This happens with paths selected with dialog.open or if the user drag and drops a badly named file into a tauri window, even if no drag and drop event listener is registered.Deleting $APPLOCALDATA/.persisted-scope fixes this, but does lose persisted scope info.
Reproduction
Example project: https://github.com/lendle/tauri-app-bad-filenames
Expected behavior
Full
tauri info
outputStack trace
No response
Additional context
There seems to be no way to guard against this because both drag and drop and dialog open attempt to add the path to the scope immediately, so you cannot inspect the path and reject it.