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")]