Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix(fs): recognise compressed file extensions in any letter case (#17017)

Ruslan Zaitseva89a82f911d9
diff --git a/libs/base/src/fs.rs b/libs/base/src/fs.rs
index 559cd13d9..98db8fc1d 100644
--- a/libs/base/src/fs.rs
+++ b/libs/base/src/fs.rs
@@ -498,7 +498,7 @@ fn get_ext(name: &str) -> &str {
fn is_compressed_file(name: &str) -> bool {
let compressed_exts = ["xz", "gz", "zip", "7z", "rar", "bz2", "tgz", "png", "jpg"];
let ext = get_ext(name);
- compressed_exts.contains(&ext)
+ compressed_exts.iter().any(|x| ext.eq_ignore_ascii_case(x))
}
pub fn validate_file_name_no_traversal(name: &str) -> ResultType<()> {
@@ -1917,4 +1917,11 @@ mod tests {
assert!(!src.exists());
assert!(dst.exists());
}
+
+ #[test]
+ fn compressed_file_extensions_ignore_case() {
+ // Cameras and phones name their photos IMG_0001.JPG.
+ assert!(is_compressed_file("IMG_0001.JPG"));
+ assert!(is_compressed_file("Backup.ZIP"));
+ }
}