Skip to content

Commit

Permalink
Fix deduplication not working without first normalizing the file name…
Browse files Browse the repository at this point in the history
… and extension
  • Loading branch information
nqkdev committed Sep 30, 2024
1 parent 7ee54ba commit afe3019
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cmd/duplicate/duplicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,21 @@ func DuplicateCommand(ctx context.Context, common *cmd.SharedFlags, args []strin
if app.IgnoreTZErrors {
d = time.Date(d.Year(), d.Month(), d.Day(), 0, d.Minute(), d.Second(), 0, time.UTC)
}

name := strings.ToUpper(a.OriginalFileName)
suffix := strings.ToUpper(path.Ext(a.OriginalPath))
if app.IgnoreExtension && strings.HasSuffix(name, suffix) {
name = strings.TrimSuffix(name, suffix)
} else if !app.IgnoreExtension && !strings.HasSuffix(name, suffix) {
name = name + suffix
}

k := duplicateKey{
Date: d,
Name: strings.ToUpper(a.OriginalFileName + path.Ext(a.OriginalPath)),
Name: name,
Type: a.Type,
}

if app.IgnoreExtension {
k.Name = strings.TrimSuffix(k.Name, path.Ext(a.OriginalPath))
}
l := app.assetsByBaseAndDate[k]
if len(l) > 0 {
dupCount++
Expand Down

0 comments on commit afe3019

Please sign in to comment.