mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 04:30:26 +03:00
Use convenience functions for url.Values over looping through keys, fix a bug in listObjectParts()
This commit is contained in:
+9
-26
@@ -25,37 +25,20 @@ import (
|
||||
|
||||
// parse bucket url queries
|
||||
func getBucketResources(values url.Values) (v drivers.BucketResourcesMetadata) {
|
||||
for key, value := range values {
|
||||
switch true {
|
||||
case key == "prefix":
|
||||
v.Prefix = value[0]
|
||||
case key == "marker":
|
||||
v.Marker = value[0]
|
||||
case key == "max-keys":
|
||||
v.Maxkeys, _ = strconv.Atoi(value[0])
|
||||
case key == "delimiter":
|
||||
v.Delimiter = value[0]
|
||||
case key == "encoding-type":
|
||||
v.EncodingType = value[0]
|
||||
}
|
||||
}
|
||||
v.Prefix = values.Get("prefix")
|
||||
v.Marker = values.Get("marker")
|
||||
v.Maxkeys, _ = strconv.Atoi(values.Get("max-keys"))
|
||||
v.Delimiter = values.Get("delimiter")
|
||||
v.EncodingType = values.Get("encoding-type")
|
||||
return
|
||||
}
|
||||
|
||||
// parse object url queries
|
||||
func getObjectResources(values url.Values) (v drivers.ObjectResourcesMetadata) {
|
||||
for key, value := range values {
|
||||
switch true {
|
||||
case key == "uploadId":
|
||||
v.UploadID = value[0]
|
||||
case key == "part-number-marker":
|
||||
v.PartNumberMarker, _ = strconv.Atoi(value[0])
|
||||
case key == "max-parts":
|
||||
v.MaxParts, _ = strconv.Atoi(value[0])
|
||||
case key == "encoding-type":
|
||||
v.EncodingType = value[0]
|
||||
}
|
||||
}
|
||||
v.UploadID = values.Get("uploadId")
|
||||
v.PartNumberMarker, _ = strconv.Atoi(values.Get("part-number-marker"))
|
||||
v.MaxParts, _ = strconv.Atoi(values.Get("max-parts"))
|
||||
v.EncodingType = values.Get("encoding-type")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user