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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *Upload) RemoveMarkupTempFile() {
|
||||||
|
if len(u.MarkedUpFilename) > 0 {
|
||||||
|
os.Remove(u.MarkedUpFilename)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (u *Upload) processUpload() error {
|
func (u *Upload) processUpload() error {
|
||||||
daulog.SendLog(fmt.Sprintf("Uploading: %s", u.OriginalFilename), daulog.LogTypeInfo)
|
daulog.SendLog(fmt.Sprintf("Uploading: %s", u.OriginalFilename), daulog.LogTypeInfo)
|
||||||
|
|
||||||
@ -264,9 +270,7 @@ func (u *Upload) processUpload() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove any marked up file
|
// remove any marked up file
|
||||||
if len(u.MarkedUpFilename) > 0 {
|
u.RemoveMarkupTempFile()
|
||||||
os.Remove(u.MarkedUpFilename)
|
|
||||||
}
|
|
||||||
|
|
||||||
if retriesRemaining == 0 {
|
if retriesRemaining == 0 {
|
||||||
daulog.SendLog("Failed to upload, even after all retries", daulog.LogTypeError)
|
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(response => response.json()) // convert to json
|
||||||
.then(json => {
|
.then(json => {
|
||||||
console.log(json);
|
console.log(json);
|
||||||
|
window.location = '/uploads.html';
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,7 @@ func (ws *WebService) modifyUpload(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
} else if change == "skip" {
|
} else if change == "skip" {
|
||||||
anUpload.State = upload.StateSkipped
|
anUpload.State = upload.StateSkipped
|
||||||
|
anUpload.RemoveMarkupTempFile()
|
||||||
res := StartUploadResponse{Success: true, Message: "upload skipped"}
|
res := StartUploadResponse{Success: true, Message: "upload skipped"}
|
||||||
resString, _ := json.Marshal(res)
|
resString, _ := json.Marshal(res)
|
||||||
w.Write(resString)
|
w.Write(resString)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user