Skip to content

Commit 929a83d

Browse files
authored
fix(core): ignore trailing slashes on scope validation, closes #3580 (#3601)
1 parent 3e18264 commit 929a83d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Ignore trailing slashes on path scope validation.

core/tauri/src/scope/fs.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5-
use std::{fmt, path::Path};
5+
use std::{
6+
fmt,
7+
path::{Path, PathBuf},
8+
};
69

710
use glob::Pattern;
811
use tauri_utils::{
@@ -44,6 +47,7 @@ impl Scope {
4447
let mut allow_patterns = Vec::new();
4548
for path in &scope.0 {
4649
if let Ok(path) = parse_path(config, package_info, env, path) {
50+
let path: PathBuf = path.components().collect();
4751
allow_patterns.push(Pattern::new(&path.to_string_lossy()).expect("invalid glob pattern"));
4852
#[cfg(windows)]
4953
{
@@ -66,6 +70,7 @@ impl Scope {
6670
};
6771

6872
if let Ok(path) = path {
73+
let path: PathBuf = path.components().collect();
6974
let allowed = self.allow_patterns.iter().any(|p| p.matches_path(&path));
7075
allowed
7176
} else {

0 commit comments

Comments
 (0)