summaryrefslogtreecommitdiff
path: root/systems/asset/src
diff options
context:
space:
mode:
Diffstat (limited to 'systems/asset/src')
-rw-r--r--systems/asset/src/asset.rs4
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);
}