From f8296d038fb36c16ade3489fe87b3a41ea1baf6e Mon Sep 17 00:00:00 2001 From: kxrn_gupta <83299258+karan5028ji@users.noreply.github.com> Date: Mon, 12 Oct 2026 19:00:21 +0530 Subject: [PATCH] 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 --- .changes/fs-require-literal-leading-dot.md | 6 ++++++ plugins/fs/src/lib.rs | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 .changes/fs-require-literal-leading-dot.md diff --git a/.changes/fs-require-literal-leading-dot.md b/.changes/fs-require-literal-leading-dot.md new file mode 100644 index 000000000..1b4aafa7f --- /dev/null +++ b/.changes/fs-require-literal-leading-dot.md @@ -0,0 +1,6 @@ +--- +fs: patch +fs-js: patch +--- + +Fix `plugins.fs.requireLiteralLeadingDot` being ignored for paths allowed with `fs_scope().allow_directory()`. diff --git a/plugins/fs/src/lib.rs b/plugins/fs/src/lib.rs index 8e04a520c..17b4f4c42 100644 --- a/plugins/fs/src/lib.rs +++ b/plugins/fs/src/lib.rs @@ -588,17 +588,25 @@ pub fn init() -> TauriPlugin> { 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")]