Check object names on windows (#9798)

Uploading files with names that could not be written to disk 
would result in "reduce your request" errors returned.

Instead check explicitly for disallowed characters and reject 
files with `Object name contains unsupported characters.`
This commit is contained in:
Klaus Post
2020-06-10 08:14:22 -07:00
committed by GitHub
parent 4790868878
commit 142b057be8
2 changed files with 13 additions and 0 deletions

View File

@@ -183,6 +183,16 @@ func checkObjectNameForLengthAndSlash(bucket, object string) error {
Object: object,
}
}
if runtime.GOOS == globalWindowsOSName {
// Explicitly disallowed characters on windows.
// Avoids most problematic names.
if strings.ContainsAny(object, `:*?"|<>`) {
return ObjectNameInvalid{
Bucket: bucket,
Object: object,
}
}
}
return nil
}