mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-16 03:10:38 +03:00
fix(core): resolve symlink on fs scope check (#9072)
This commit is contained in:
parent
6a47dd212c
commit
fe18012d30
5
.changes/fix-fs-scope-check-symlink.md
Normal file
5
.changes/fix-fs-scope-check-symlink.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri": patch:bug
|
||||||
|
---
|
||||||
|
|
||||||
|
Resolve symlinks on the filesystem scope check.
|
@ -298,6 +298,14 @@ impl Scope {
|
|||||||
/// Determines if the given path is allowed on this scope.
|
/// Determines if the given path is allowed on this scope.
|
||||||
pub fn is_allowed<P: AsRef<Path>>(&self, path: P) -> bool {
|
pub fn is_allowed<P: AsRef<Path>>(&self, path: P) -> bool {
|
||||||
let path = path.as_ref();
|
let path = path.as_ref();
|
||||||
|
let path = if path.is_symlink() {
|
||||||
|
match std::fs::read_link(path) {
|
||||||
|
Ok(p) => p,
|
||||||
|
Err(_) => return false,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
path.to_path_buf()
|
||||||
|
};
|
||||||
let path = if !path.exists() {
|
let path = if !path.exists() {
|
||||||
crate::Result::Ok(path.to_path_buf())
|
crate::Result::Ok(path.to_path_buf())
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user