diff --git a/lib/protocol/nativemodel_windows.go b/lib/protocol/nativemodel_windows.go index 29b092da2..2c76f294a 100644 --- a/lib/protocol/nativemodel_windows.go +++ b/lib/protocol/nativemodel_windows.go @@ -41,7 +41,7 @@ func (m nativeModel) Request(deviceID DeviceID, folder string, name string, offs func fixupFiles(folder string, files []FileInfo) { for i, f := range files { - if strings.ContainsAny(f.Name, disallowedCharacters) { + if strings.ContainsAny(f.Name, disallowedCharacters) || strings.HasSuffix(f.Name, " ") { if f.IsDeleted() { // Don't complain if the file is marked as deleted, since it // can't possibly exist here anyway. diff --git a/lib/protocol/nativemodel_windows_test.go b/lib/protocol/nativemodel_windows_test.go new file mode 100644 index 000000000..ef2a7757d --- /dev/null +++ b/lib/protocol/nativemodel_windows_test.go @@ -0,0 +1,27 @@ +// Copyright (C) 2016 The Protocol Authors. + +// +build windows + +package protocol + +import "testing" + +func TestFixupFiles(t *testing.T) { + fs := []FileInfo{ + {Name: "ok"}, // This file is OK + {Name: "b