taggart

Simple golang tagging filesystem webapp
Log | Files | Refs

commit 0e44ced1d20b639b21421fca096cc69c293e358d
parent 3c0d7cfc325f19824307db1fc573e67bb949efd9
Author: breadcat <breadcat@users.noreply.github.com>
Date:   Wed,  1 Oct 2025 22:32:17 +0100

Also delete thumbnails on file deletion

Diffstat:
Mmain.go | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/main.go b/main.go @@ -540,6 +540,14 @@ func fileDeleteHandler(w http.ResponseWriter, r *http.Request, parts []string) { log.Printf("Warning: Failed to delete physical file %s: %v", currentFile.Path, err) } + // Delete thumbnail if it exists + thumbPath := filepath.Join(config.UploadDir, "thumbnails", currentFile.Filename+".jpg") + if _, err := os.Stat(thumbPath); err == nil { + if err := os.Remove(thumbPath); err != nil { + log.Printf("Warning: Failed to delete thumbnail %s: %v", thumbPath, err) + } + } + http.Redirect(w, r, "/?deleted="+currentFile.Filename, http.StatusSeeOther) }