Browse Source

Merge pull request #1332 from bingoohuang/master

rename 'needle' which collides with imported package name
pull/1341/head
Chris Lu 5 years ago
committed by GitHub
parent
commit
6286a454c7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      weed/server/volume_server_handlers_write.go

14
weed/server/volume_server_handlers_write.go

@ -42,18 +42,18 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
needle, originalSize, ne := needle.CreateNeedleFromRequest(r, vs.FixJpgOrientation, vs.fileSizeLimitBytes)
reqNeedle, originalSize, ne := needle.CreateNeedleFromRequest(r, vs.FixJpgOrientation, vs.fileSizeLimitBytes)
if ne != nil { if ne != nil {
writeJsonError(w, r, http.StatusBadRequest, ne) writeJsonError(w, r, http.StatusBadRequest, ne)
return return
} }
ret := operation.UploadResult{} ret := operation.UploadResult{}
isUnchanged, writeError := topology.ReplicatedWrite(vs.GetMaster(), vs.store, volumeId, needle, r)
isUnchanged, writeError := topology.ReplicatedWrite(vs.GetMaster(), vs.store, volumeId, reqNeedle, r)
// http 204 status code does not allow body // http 204 status code does not allow body
if writeError == nil && isUnchanged { if writeError == nil && isUnchanged {
setEtag(w, needle.Etag())
setEtag(w, reqNeedle.Etag())
w.WriteHeader(http.StatusNoContent) w.WriteHeader(http.StatusNoContent)
return return
} }
@ -63,12 +63,12 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
httpStatus = http.StatusInternalServerError httpStatus = http.StatusInternalServerError
ret.Error = writeError.Error() ret.Error = writeError.Error()
} }
if needle.HasName() {
ret.Name = string(needle.Name)
if reqNeedle.HasName() {
ret.Name = string(reqNeedle.Name)
} }
ret.Size = uint32(originalSize) ret.Size = uint32(originalSize)
ret.ETag = needle.Etag()
ret.Mime = string(needle.Mime)
ret.ETag = reqNeedle.Etag()
ret.Mime = string(reqNeedle.Mime)
setEtag(w, ret.ETag) setEtag(w, ret.ETag)
writeJsonQuiet(w, r, httpStatus, ret) writeJsonQuiet(w, r, httpStatus, ret)
} }

Loading…
Cancel
Save