Skip to content

Commit

Permalink
fix empty filename auto resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed Oct 11, 2024
1 parent 924a7b7 commit 4dc2182
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func checkEmptyFilenameConflict(

if ctx.autoFix {
// The file is left unchanged
ctx.change.Target = ctx.change.Source
ctx.change.AutoFixTarget(ctx.change.Source)
ctx.change.Status = status.Unchanged
}
}
Expand Down Expand Up @@ -425,7 +425,7 @@ func checkAndHandleConflict(ctx validationCtx, loopIndex *int) (detected bool) {
}

if i == len(checks)-1 {
// Special handling for checkTargetFileChangingConflict
// INFO: Special handling for checkTargetFileChangingConflict
// Restart the iteration from the beginning
*loopIndex = -1

Expand Down
13 changes: 13 additions & 0 deletions validate/validate_test/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ func TestValidate(t *testing.T) {
"testdata/images/dsc-001.arw",
},
},
{
Name: "auto fix empty filename conflict",
Changes: file.Changes{
{
Source: "1984.pdf",
Target: "",
BaseDir: "ebooks",
Status: status.Unchanged,
},
},
Want: []string{"ebooks/1984.pdf"},
Args: autoFixArgs,
},
{
Name: "auto fix path exists conflict",
Changes: file.Changes{
Expand Down

0 comments on commit 4dc2182

Please sign in to comment.