mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
This commit is contained in:
committed by
GitHub
parent
929a83dd4d
commit
4d0e2eccd9
5
.changes/fix-path-scope-first-component.md
Normal file
5
.changes/fix-path-scope-first-component.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Fixes filesystem and asset scope stripping the first component of the allowed path.
|
||||
@@ -138,18 +138,22 @@ pub fn parse<P: AsRef<Path>>(
|
||||
) -> crate::api::Result<PathBuf> {
|
||||
let mut p = PathBuf::new();
|
||||
let mut components = path.as_ref().components();
|
||||
if let Some(Component::Normal(str)) = components.next() {
|
||||
if let Some(base_directory) = BaseDirectory::from_variable(&str.to_string_lossy()) {
|
||||
p.push(resolve_path(
|
||||
config,
|
||||
package_info,
|
||||
env,
|
||||
"",
|
||||
Some(base_directory),
|
||||
)?);
|
||||
} else {
|
||||
p.push(str);
|
||||
match components.next() {
|
||||
Some(Component::Normal(str)) => {
|
||||
if let Some(base_directory) = BaseDirectory::from_variable(&str.to_string_lossy()) {
|
||||
p.push(resolve_path(
|
||||
config,
|
||||
package_info,
|
||||
env,
|
||||
"",
|
||||
Some(base_directory),
|
||||
)?);
|
||||
} else {
|
||||
p.push(str);
|
||||
}
|
||||
}
|
||||
Some(component) => p.push(component),
|
||||
None => (),
|
||||
}
|
||||
|
||||
for component in components {
|
||||
|
||||
Reference in New Issue
Block a user