Merge pull request #577 from fkautz/pr_out_router_should_work_with_uploads_unescaped_now

master
Harshavardhana 10 years ago
commit 5a372f4dd7
  1. 2
      pkg/api/api_definitions.go
  2. 7
      pkg/api/api_object_handlers.go
  3. 2
      pkg/api/api_router.go

@ -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,
}

@ -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

@ -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")

Loading…
Cancel
Save