Browse Source

fix call writeJsonError with a nil value error after check another err (#6673)

the dbErr != nil and err is nil

when call writeJsonError with a nil value error, it may panic
pull/2932/merge
alingse 4 weeks ago
committed by GitHub
parent
commit
46b3a71a1f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      weed/server/filer_server_handlers_tagging.go

4
weed/server/filer_server_handlers_tagging.go

@ -45,7 +45,7 @@ func (fs *FilerServer) PutTaggingHandler(w http.ResponseWriter, r *http.Request)
if dbErr := fs.filer.CreateEntry(ctx, existingEntry, false, false, nil, false, fs.filer.MaxFilenameLength); dbErr != nil {
glog.V(0).Infof("failing to update %s tagging : %v", path, dbErr)
writeJsonError(w, r, http.StatusInternalServerError, err)
writeJsonError(w, r, http.StatusInternalServerError, dbErr)
return
}
@ -111,7 +111,7 @@ func (fs *FilerServer) DeleteTaggingHandler(w http.ResponseWriter, r *http.Reque
if dbErr := fs.filer.CreateEntry(ctx, existingEntry, false, false, nil, false, fs.filer.MaxFilenameLength); dbErr != nil {
glog.V(0).Infof("failing to delete %s tagging : %v", path, dbErr)
writeJsonError(w, r, http.StatusInternalServerError, err)
writeJsonError(w, r, http.StatusInternalServerError, dbErr)
return
}

Loading…
Cancel
Save