Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/fingerprint/sources_checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (checker *ChecksumChecker) checksumFilePath(t *ast.Task) string {
return filepath.Join(checker.tempDir, "checksum", normalizeFilename(t.Name()))
}

var checksumFilenameRegexp = regexp.MustCompile("[^A-z0-9]")
var checksumFilenameRegexp = regexp.MustCompile("[^A-Za-z0-9]")

// replaces invalid characters on filenames with "-"
func normalizeFilename(f string) string {
Expand Down
6 changes: 6 additions & 0 deletions internal/fingerprint/sources_checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ func TestNormalizeFilename(t *testing.T) {
{"foo/bar/baz", "foo-bar-baz"},
{"foo@bar/baz", "foo-bar-baz"},
{"foo1bar2baz3", "foo1bar2baz3"},
// Characters in the ASCII range between 'Z' (90) and 'a' (97) must
// also be normalized. A "[A-z]" class would wrongly include these.
{"foo\\bar", "foo-bar"},
{"foo_bar", "foo-bar"},
{"foo[bar]baz", "foo-bar-baz"},
{"foo^bar`baz", "foo-bar-baz"},
}
for _, test := range tests {
assert.Equal(t, test.Out, normalizeFilename(test.In))
Expand Down