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)
|
||||
bucket := vars["bucket"]
|
||||
object := vars["object"]
|
||||
if !strings.HasPrefix(object, "/") {
|
||||
object = "/" + object
|
||||
if strings.HasPrefix(object, "/") {
|
||||
object = object[1:]
|
||||
}
|
||||
|
||||
apiError := GetAPIError(errorCode)
|
||||
|
@ -45,7 +45,7 @@ func getRESTErrorResponse(err APIError, resource string, bucket, object string)
|
|||
return RESTErrorResponse{
|
||||
Code: err.Code,
|
||||
BucketName: bucket,
|
||||
Key: object[1:],
|
||||
Key: object,
|
||||
Message: err.Description,
|
||||
Resource: resource,
|
||||
RequestID: fmt.Sprintf("%d", time.Now().UnixNano()),
|
||||
|
|
Loading…
Reference in a new issue