mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 22:41:58 +03:00
Fix insecure extension check in read_sheet_file
Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
parent
bede889ced
commit
5b115d27f7
1 changed files with 6 additions and 2 deletions
|
|
@ -938,8 +938,12 @@ fn load_extensions(app: AppHandle) -> Vec<ExtensionScript> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_sheet_path(path: &str) -> bool {
|
fn is_sheet_path(path: &str) -> bool {
|
||||||
let lower = path.to_lowercase();
|
std::path::Path::new(path)
|
||||||
lower.ends_with(".numi") || lower.ends_with(".sum")
|
.extension()
|
||||||
|
.map_or(false, |ext| {
|
||||||
|
let ext = ext.to_string_lossy().to_lowercase();
|
||||||
|
ext == "numi" || ext == "sum"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A sheet handed to us by the OS (file association, second launch): same
|
/// A sheet handed to us by the OS (file association, second launch): same
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue