Make asset watcher work when path contains "../" (#18023)

# Objective

Fixes #18022

## Solution

Canonicalize asset paths

## Testing

I ran the examples `sprite`, `desk_toy` and `game_menu` with the feature
`file_watcher` enabled. All correctly updated an asset when the source
file was altered.

Co-authored-by: Threadzless <threadzless@gmail.com>
This commit is contained in:
Joshua Maleszewski 2025-03-02 13:15:27 -05:00 committed by GitHub
parent ef9b898c2d
commit 1ef334cc25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -262,7 +262,8 @@ impl FilesystemEventHandler for FileEventHandler {
self.last_event = None;
}
fn get_path(&self, absolute_path: &Path) -> Option<(PathBuf, bool)> {
Some(get_asset_path(&self.root, absolute_path))
let absolute_path = absolute_path.canonicalize().unwrap();
Some(get_asset_path(&self.root, &absolute_path))
}
fn handle(&mut self, _absolute_paths: &[PathBuf], event: AssetSourceEvent) {