Cleanup temp files and return to upload page after editing.
This commit is contained in:
parent
563de29fcf
commit
2f5bb2ff36
@ -111,6 +111,12 @@ func (u *Uploader) UploadById(id int32) *Upload {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *Upload) RemoveMarkupTempFile() {
|
||||
if len(u.MarkedUpFilename) > 0 {
|
||||
os.Remove(u.MarkedUpFilename)
|
||||
}
|
||||
}
|
||||
|
||||
func (u *Upload) processUpload() error {
|
||||
daulog.SendLog(fmt.Sprintf("Uploading: %s", u.OriginalFilename), daulog.LogTypeInfo)
|
||||
|
||||
@ -264,9 +270,7 @@ func (u *Upload) processUpload() error {
|
||||
}
|
||||
|
||||
// remove any marked up file
|
||||
if len(u.MarkedUpFilename) > 0 {
|
||||
os.Remove(u.MarkedUpFilename)
|
||||
}
|
||||
u.RemoveMarkupTempFile()
|
||||
|
||||
if retriesRemaining == 0 {
|
||||
daulog.SendLog("Failed to upload, even after all retries", daulog.LogTypeError)
|
||||
|
@ -148,6 +148,7 @@ function editor() {
|
||||
.then(response => response.json()) // convert to json
|
||||
.then(json => {
|
||||
console.log(json);
|
||||
window.location = '/uploads.html';
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -273,6 +273,7 @@ func (ws *WebService) modifyUpload(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
} else if change == "skip" {
|
||||
anUpload.State = upload.StateSkipped
|
||||
anUpload.RemoveMarkupTempFile()
|
||||
res := StartUploadResponse{Success: true, Message: "upload skipped"}
|
||||
resString, _ := json.Marshal(res)
|
||||
w.Write(resString)
|
||||
|
Loading…
x
Reference in New Issue
Block a user