fix(fs): pass require_literal_leading_dot when initializing runtime scope (#3701)

When initializing the plugin's runtime scope in .setup, pass 
equire_literal_leading_dot from config to FsScope::Scope instead of using FsScope::default() so that paths allowed dynamically via s_scope().allow_directory() inherit the configured value.

Closes #3699
This commit is contained in:
kxrn_gupta authored and GitHub committed 2026-10-12 10:30:21 -03:00
1 parent 4356356dab
commit f8296d038f
2 files changed
+19 -5

No files matched your search

@@ -0,0 +1,6 @@
---
fs: patch
fs-js: patch
---
Fix `plugins.fs.requireLiteralLeadingDot` being ignored for paths allowed with `fs_scope().allow_directory()`.
+13 -5
View File
@@ -588,17 +588,25 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<config::Config>> {
watcher::watch,
])
.setup(|app, api| {
let require_literal_leading_dot = api
.config()
.as_ref()
.and_then(|c| c.require_literal_leading_dot);
let scope = Scope {
require_literal_leading_dot: api
.config()
.as_ref()
.and_then(|c| c.require_literal_leading_dot),
require_literal_leading_dot,
scope_dropped_paths: api
.config()
.as_ref()
.and_then(|c| c.scope_dropped_paths)
.unwrap_or(true),
scope: tauri::fs::Scope::new(app, &FsScope::default())?,
scope: tauri::fs::Scope::new(
app,
&FsScope::Scope {
allow: Vec::new(),
deny: Vec::new(),
require_literal_leading_dot,
},
)?,
};
#[cfg(target_os = "android")]