fix: display error page instead of panic on non existant note #30

Merged
jriou merged 1 commit from tapiron/coller:fix/panic_on_non_existing_non_password_protected_note into main 2025-09-15 18:30:04 +02:00
Showing only changes of commit 28cdb3ee8f - Show all commits

fix: display error page instead of panic on non existant note

Thibault Piron 2025-09-15 17:41:12 +02:00
Signed by untrusted user who does not match committer: tapiron
GPG key ID: 37EE240037F90B38

View file

@ -341,6 +341,12 @@ func (h *GetWebNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if note == nil {
h.PageData.Err = fmt.Errorf("Note doesn't exist or has been deleted")
h.Templates.ExecuteTemplate(w, templateName, h.PageData)
return
}
if note.Encrypted {
h.PageData.Err = fmt.Errorf("note is encrypted")
h.Templates.ExecuteTemplate(w, templateName, h.PageData)