fs: Fail createObject with appropriate message.

Fail createObject() if a file already exists and one attempts
to create a prefix/directory by same name.

Send an approriate error back to the client as 409 Conflict.
This commit is contained in:
Harshavardhana
2016-02-02 15:23:28 -08:00
parent 729e032a50
commit 835b297ba7
4 changed files with 59 additions and 31 deletions

View File

@@ -170,6 +170,8 @@ func (api CloudStorageAPI) PutObjectHandler(w http.ResponseWriter, req *http.Req
writeErrorResponse(w, req, EntityTooLarge, req.URL.Path)
case fs.InvalidDigest:
writeErrorResponse(w, req, InvalidDigest, req.URL.Path)
case fs.ObjectExistsAsPrefix:
writeErrorResponse(w, req, ObjectExistsAsPrefix, req.URL.Path)
default:
writeErrorResponse(w, req, InternalError, req.URL.Path)
}