diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-02-08 00:01:02 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-02-08 00:01:02 +0800 |
| commit | 2f10e0d94c61916dd36a03df2576223b135b6ccd (patch) | |
| tree | d28f132dbb5d0a13c5575c0b1762b18a167d8737 /systems/asset/src | |
| parent | 5ad175c2532880da714e82b283770a7a2a45364f (diff) | |
Remove duplicate file name conversion in path validation
Diffstat (limited to 'systems/asset/src')
| -rw-r--r-- | systems/asset/src/asset.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/systems/asset/src/asset.rs b/systems/asset/src/asset.rs index 78ee0e4..a3b1c6a 100644 --- a/systems/asset/src/asset.rs +++ b/systems/asset/src/asset.rs @@ -383,18 +383,18 @@ async fn check_handle_is_cross_directory( } fn check_path(file_name: &OsStr) -> Result<Cow<'_, str>, PrecheckFailed> { + let file_name_str = file_name.to_string_lossy(); + // When operating on a TEMP_FILE or LOCK_FILE, // names like `~~foo.txt` or `.tmp_.tmp_foo.txt` would be generated // This is not expected and should result in an error // Check if the file name starts with ~ - let file_name_str = file_name.to_string_lossy(); if file_name_str.starts_with(LOCK_FILE_PREFIX) { return Err(PrecheckFailed::LockOnLockFile); } // Check if the file name starts with .tmp_ - let file_name_str = file_name.to_string_lossy(); if file_name_str.starts_with(TEMP_FILE_PREFIX) { return Err(PrecheckFailed::TempForTempFile); } |
