Skip to content

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

hbb_common: simplify is_compressed_file (#10436)

Xiaobo Liu0dbd3094ec2f
diff --git a/libs/hbb_common/src/fs.rs b/libs/hbb_common/src/fs.rs
index 2605f304e..1488ffd93 100644
--- a/libs/hbb_common/src/fs.rs
+++ b/libs/hbb_common/src/fs.rs
@@ -303,16 +303,9 @@ fn get_ext(name: &str) -> &str {
#[inline]
fn is_compressed_file(name: &str) -> bool {
+ let compressed_exts = ["xz", "gz", "zip", "7z", "rar", "bz2", "tgz", "png", "jpg"];
let ext = get_ext(name);
- ext == "xz"
- || ext == "gz"
- || ext == "zip"
- || ext == "7z"
- || ext == "rar"
- || ext == "bz2"
- || ext == "tgz"
- || ext == "png"
- || ext == "jpg"
+ compressed_exts.contains(&ext)
}
impl TransferJob {