mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-22 20:53:32 +08:00
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
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user