mirror of
https://github.com/versity/versitygw.git
synced 2026-09-19 06:32:10 +00:00
fix: prevent directory type object uploads containing data
Since objects with trailing "/" are mapped to directories in the posix filesystem, they must not contain data since there is no place to store that data. This checks both PutObject and CreateMultipartUpload for invalid directory object types containing data.
This commit is contained in:
@@ -115,6 +115,7 @@ const (
|
||||
// Non-AWS errors
|
||||
ErrExistingObjectIsDirectory
|
||||
ErrObjectParentIsFile
|
||||
ErrDirectoryObjectContainsData
|
||||
)
|
||||
|
||||
var errorCodeResponse = map[ErrorCode]APIError{
|
||||
@@ -408,6 +409,11 @@ var errorCodeResponse = map[ErrorCode]APIError{
|
||||
Description: "Object parent already exists as a file.",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
},
|
||||
ErrDirectoryObjectContainsData: {
|
||||
Code: "DirectoryObjectContainsData",
|
||||
Description: "Directory object contains data payload.",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
}
|
||||
|
||||
// GetAPIError provides API Error for input API error code.
|
||||
|
||||
Reference in New Issue
Block a user