mirror of
https://github.com/minio/minio.git
synced 2025-04-21 11:04:20 -04:00
Return complete Location URL in CompleteMultipartUpload (#5692)
Remove getLocation function. Fixes #5687
This commit is contained in:
parent
1c91c7b54d
commit
7c747a9643
@ -268,11 +268,6 @@ type PostResponse struct {
|
|||||||
Location string
|
Location string
|
||||||
}
|
}
|
||||||
|
|
||||||
// getLocation get URL location.
|
|
||||||
func getLocation(r *http.Request) string {
|
|
||||||
return path.Clean(r.URL.Path) // Clean any trailing slashes.
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns "https" if the tls boolean is true, "http" otherwise.
|
// returns "https" if the tls boolean is true, "http" otherwise.
|
||||||
func getURLScheme(tls bool) string {
|
func getURLScheme(tls bool) string {
|
||||||
if tls {
|
if tls {
|
||||||
@ -283,6 +278,10 @@ func getURLScheme(tls bool) string {
|
|||||||
|
|
||||||
// getObjectLocation gets the fully qualified URL of an object.
|
// getObjectLocation gets the fully qualified URL of an object.
|
||||||
func getObjectLocation(r *http.Request, domain, bucket, object string) string {
|
func getObjectLocation(r *http.Request, domain, bucket, object string) string {
|
||||||
|
// unit tests do not have host set.
|
||||||
|
if r.Host == "" {
|
||||||
|
return path.Clean(r.URL.Path)
|
||||||
|
}
|
||||||
proto := handlers.GetSourceScheme(r)
|
proto := handlers.GetSourceScheme(r)
|
||||||
if proto == "" {
|
if proto == "" {
|
||||||
proto = getURLScheme(globalIsSSL)
|
proto = getURLScheme(globalIsSSL)
|
||||||
|
@ -430,7 +430,7 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure to add Location information here only for bucket
|
// Make sure to add Location information here only for bucket
|
||||||
w.Header().Set("Location", getLocation(r))
|
w.Header().Set("Location", path.Clean(r.URL.Path)) // Clean any trailing slashes.
|
||||||
|
|
||||||
writeSuccessResponseHeadersOnly(w)
|
writeSuccessResponseHeadersOnly(w)
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1312,7 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get object location.
|
// Get object location.
|
||||||
location := getLocation(r)
|
location := getObjectLocation(r, globalDomainName, bucket, object)
|
||||||
// Generate complete multipart response.
|
// Generate complete multipart response.
|
||||||
response := generateCompleteMultpartUploadResponse(bucket, object, location, objInfo.ETag)
|
response := generateCompleteMultpartUploadResponse(bucket, object, location, objInfo.ETag)
|
||||||
encodedSuccessResponse := encodeResponse(response)
|
encodedSuccessResponse := encodeResponse(response)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user