mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid possible empty object
This commit is contained in:
parent
310e31424e
commit
b71c3cfba4
|
@ -31,8 +31,8 @@ func WriteErrorResponse(w http.ResponseWriter, errorCode ErrorCode, r *http.Requ
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
bucket := vars["bucket"]
|
bucket := vars["bucket"]
|
||||||
object := vars["object"]
|
object := vars["object"]
|
||||||
if !strings.HasPrefix(object, "/") {
|
if strings.HasPrefix(object, "/") {
|
||||||
object = "/" + object
|
object = object[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
apiError := GetAPIError(errorCode)
|
apiError := GetAPIError(errorCode)
|
||||||
|
@ -45,7 +45,7 @@ func getRESTErrorResponse(err APIError, resource string, bucket, object string)
|
||||||
return RESTErrorResponse{
|
return RESTErrorResponse{
|
||||||
Code: err.Code,
|
Code: err.Code,
|
||||||
BucketName: bucket,
|
BucketName: bucket,
|
||||||
Key: object[1:],
|
Key: object,
|
||||||
Message: err.Description,
|
Message: err.Description,
|
||||||
Resource: resource,
|
Resource: resource,
|
||||||
RequestID: fmt.Sprintf("%d", time.Now().UnixNano()),
|
RequestID: fmt.Sprintf("%d", time.Now().UnixNano()),
|
||||||
|
|
Loading…
Reference in a new issue