diff --git a/internal/paths/real.go b/internal/paths/real.go index 271b8c2..d874ec4 100644 --- a/internal/paths/real.go +++ b/internal/paths/real.go @@ -194,4 +194,6 @@ var shortNameForm = regexp.MustCompile(`~[0-9]+(\.[^.]*)?$`) // short name, which may stand for a folder of another name. Other names // with a "~" are fine: a real short name elsewhere is caught on disk by // CheckSyncable. -func LooksShort(name string) bool { return shortNameForm.MatchString(name) } +func LooksShort(name string) bool { + return shortNameForm.MatchString(strings.TrimRight(name, ". ")) +} diff --git a/internal/paths/real_test.go b/internal/paths/real_test.go index e7f2484..99145bb 100644 --- a/internal/paths/real_test.go +++ b/internal/paths/real_test.go @@ -88,7 +88,7 @@ func TestResolveShortNameForm(t *testing.T) { t.Errorf("Resolve(home, %q) refused", rel) } } - for _, rel := range []string{"PROGRA~1", "MICROS~1.TXT", "Games/SAVEGA~12", "a~1."} { + for _, rel := range []string{"PROGRA~1", "MICROS~1.TXT", "Games/SAVEGA~12", "a~1.", "PROGRA~1 ", "PROGRA~1..", "MICROS~1.TXT."} { if p, ok := Resolve(Home, rel); ok { t.Errorf("Resolve(home, %q) = %q, want refused", rel, p) }