Merge pull request #577 from fkautz/pr_out_router_should_work_with_uploads_unescaped_now

This commit is contained in:
Harshavardhana 2015-05-07 21:43:28 -07:00
commit 5a372f4dd7
3 changed files with 5 additions and 6 deletions

View File

@ -128,11 +128,9 @@ var notimplementedBucketResourceNames = map[string]bool{
"requestPayment": true,
"versioning": true,
"website": true,
"uploads": true,
}
// List of not implemented object queries
var notimplementedObjectResourceNames = map[string]bool{
"torrent": true,
"uploads": true,
}

View File

@ -213,6 +213,7 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques
}
func (server *minioAPI) newMultipartUploadHandler(w http.ResponseWriter, req *http.Request) {
// TODO ensure ?uploads is part of URL
acceptsContentType := getContentType(req)
if acceptsContentType == unknownContentType {
writeErrorResponse(w, req, NotAcceptable, acceptsContentType, req.URL.Path)
@ -232,7 +233,7 @@ func (server *minioAPI) newMultipartUploadHandler(w http.ResponseWriter, req *ht
var err error
if uploadID, err = server.driver.NewMultipartUpload(bucket, object, ""); err != nil {
log.Println(iodine.New(err, nil))
writeErrorResponse(w, req, NotImplemented, acceptsContentType, req.URL.Path)
writeErrorResponse(w, req, NotAcceptable, acceptsContentType, req.URL.Path)
return
}
response := generateInitiateMultipartUploadResult(bucket, object, uploadID)
@ -287,7 +288,7 @@ func (server *minioAPI) putObjectPartHandler(w http.ResponseWriter, req *http.Re
vars := mux.Vars(req)
bucket = vars["bucket"]
object = vars["object"]
uploadID := vars["uploadID"]
uploadID := vars["uploadId"]
partIDString := vars["partNumber"]
partID, err := strconv.Atoi(partIDString)
if err != nil {
@ -351,7 +352,7 @@ func (server *minioAPI) completeMultipartUploadHandler(w http.ResponseWriter, re
vars := mux.Vars(req)
bucket := vars["bucket"]
object := vars["object"]
uploadID := vars["uploadID"]
uploadID := vars["uploadId"]
for _, part := range parts.Part {
partMap[part.PartNumber] = part.ETag

View File

@ -49,9 +49,9 @@ func HTTPHandler(driver drivers.Driver) http.Handler {
mux.HandleFunc("/{bucket}/{object:.*}", api.headObjectHandler).Methods("HEAD")
if featureflags.Get(featureflags.MultipartPutObject) {
log.Println("Enabling feature", featureflags.MultipartPutObject)
mux.HandleFunc("/{bucket}/{object:.*}?uploads", api.newMultipartUploadHandler).Methods("POST")
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectPartHandler).Queries("partNumber", "{partNumber:[0-9]+}", "uploadId", "{uploadId:.*}").Methods("PUT")
mux.HandleFunc("/{bucket}/{object:.*}", api.completeMultipartUploadHandler).Queries("uploadId", "{uploadId:.*}").Methods("POST")
mux.HandleFunc("/{bucket}/{object:.*}", api.newMultipartUploadHandler).Methods("POST")
}
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT")