Skip to content

Commit

Permalink
fix for logic error.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Sep 10, 2024
1 parent f824bba commit 3bc9c13
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/config/repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,23 +659,23 @@ func RemoveImage(basename, path, backupDir string) error {
if filename, found := strings.CutSuffix(basename, ext); found {
if len(filename) == cflen {
filename, _ = helper.CfUUID(filename)
newpath := filepath.Dir(path)
switch ext {
case png, webp:
rename(path, "rename cfid "+ext, filepath.Join(newpath, filename+ext))
return nil
}
}
if err := uuid.Validate(filename); err != nil {
remove(basename, "remove invalid cfid to uuid", path, backupDir)
remove(basename, "remove invalid uuid image", path, backupDir)
return nil //nolint:nilerr
}
newpath := filepath.Dir(path)
switch ext {
case png, webp:
rename(path, "rename cfid "+ext, filepath.Join(newpath, filename+ext))
return nil
}
}
switch ext {
case png, webp:
return nil
default:
remove(basename, "remove invalid ext", path, backupDir)
remove(basename, "remove invalid uuid ext", path, backupDir)
}
return nil
}
Expand Down

0 comments on commit 3bc9c13

Please sign in to comment.