From c8552ce7d33d7be5eddcc223b8591a671d039bf3 Mon Sep 17 00:00:00 2001 From: Justin <51927580+jsheaves-stack@users.noreply.github.com> Date: Tue, 25 Nov 2025 00:42:55 +0000 Subject: [PATCH] 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) --- packages/web/src/files.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/web/src/files.rs b/packages/web/src/files.rs index 75a3b2994..d09c2e41d 100644 --- a/packages/web/src/files.rs +++ b/packages/web/src/files.rs @@ -135,6 +135,16 @@ impl NativeFileData for WebFileData { } 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()) }