-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugSomething isn't workingSomething isn't workingrefactorCode refactor or cleanup with no functional changesCode refactor or cleanup with no functional changes
Description
Lines 62 to 85 in a440b79
fName, err = app.media.Put(fName, contentType, src) | |
if err != nil { | |
app.log.Printf("error uploading file: %v", err) | |
cleanUp = true | |
return echo.NewHTTPError(http.StatusInternalServerError, | |
app.i18n.Ts("media.errorUploading", "error", err.Error())) | |
} | |
var ( | |
thumbfName = "" | |
width = 0 | |
height = 0 | |
) | |
defer func() { | |
// If any of the subroutines in this function fail, | |
// the uploaded image should be removed. | |
if cleanUp { | |
app.media.Delete(fName) | |
if thumbfName != "" { | |
app.media.Delete(thumbfName) | |
} | |
} | |
}() |
when err != nil
in this code there should be cleanup done, but the cleanup function has not been yet deferred.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingrefactorCode refactor or cleanup with no functional changesCode refactor or cleanup with no functional changes