mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Fix file extension unwrap panic
This commit is contained in:
parent
022f23e3ab
commit
1efb0d74b6
1 changed files with 2 additions and 2 deletions
|
|
@ -41,8 +41,8 @@ pub fn free_file(mut path: PathBuf) -> PathBuf {
|
|||
while path.exists() {
|
||||
i += 1;
|
||||
|
||||
let ext = path.extension().unwrap().to_string_lossy();
|
||||
let mut filename = path.file_stem().unwrap().to_str().unwrap();
|
||||
let ext = path.extension().unwrap_or_default().to_string_lossy();
|
||||
let mut filename = path.file_stem().unwrap_or_default().to_str().unwrap();
|
||||
|
||||
if filename.ends_with(&format!(" ({})", i - 1)) {
|
||||
filename = filename.strip_suffix(&format!(" ({})", i - 1)).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue