Modified the NativeFileData path function for WebFileData to return the webkitRelativePath property if it exists, or just the file name if it does not exist. (#5015)
This commit is contained in:
1 parent
0dd2cb4b21
commit
c8552ce7d3
1 file changed
+10
@@ -135,6 +135,16 @@ impl NativeFileData for WebFileData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn path(&self) -> std::path::PathBuf {
|
fn path(&self) -> std::path::PathBuf {
|
||||||
|
let key = JsValue::from_str("webkitRelativePath");
|
||||||
|
|
||||||
|
if let Ok(value) = js_sys::Reflect::get(&self.file, &key) {
|
||||||
|
if let Some(path_str) = value.as_string() {
|
||||||
|
if !path_str.is_empty() {
|
||||||
|
return std::path::PathBuf::from(path_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::path::PathBuf::from(self.file.name())
|
std::path::PathBuf::from(self.file.name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user