From ce6447fea4060174e0f02276f1cb7b059b9d275e Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 7 May 2022 01:03:20 +0500 Subject: [PATCH] Fix deletion of media hyphae with no text --- shroom/delete.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shroom/delete.go b/shroom/delete.go index 958262e..48c9a21 100644 --- a/shroom/delete.go +++ b/shroom/delete.go @@ -18,7 +18,11 @@ func Delete(u *user.User, h hyphae.ExistingHypha) error { originalText, _ := FetchTextFile(h) switch h := h.(type) { case *hyphae.MediaHypha: - hop.WithFilesRemoved(h.MediaFilePath(), h.TextFilePath()) + if h.HasTextFile() { + hop.WithFilesRemoved(h.MediaFilePath(), h.TextFilePath()) + } else { + hop.WithFilesRemoved(h.MediaFilePath()) + } case *hyphae.TextualHypha: hop.WithFilesRemoved(h.TextFilePath()) }