mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
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:
parent
4790868878
commit
142b057be8
@ -183,6 +183,16 @@ func checkObjectNameForLengthAndSlash(bucket, object string) error {
|
|||||||
Object: object,
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1289,6 +1289,9 @@ func (s *posix) CreateFile(volume, path string, fileSize int64, r io.Reader) (er
|
|||||||
// Create top level directories if they don't exist.
|
// Create top level directories if they don't exist.
|
||||||
// with mode 0777 mkdir honors system umask.
|
// with mode 0777 mkdir honors system umask.
|
||||||
if err = mkdirAll(slashpath.Dir(filePath), 0777); err != nil {
|
if err = mkdirAll(slashpath.Dir(filePath), 0777); err != nil {
|
||||||
|
if errors.Is(err, &os.PathError{}) {
|
||||||
|
return errFileAccessDenied
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user