1
0
Fork 0
forked from jriou/coller

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

Same that jriou/coller#24 but for non password protected notes

Co-authored-by: Thibault Piron <thibault.a.piron@gmail.com>
Reviewed-on: jriou/coller#30
Reviewed-by: Julien Riou <jriou@monitoring@riou.xyz>
Co-authored-by: tapiron <tapiron@monitoring@riou.xyz>
Co-committed-by: tapiron <tapiron@monitoring@riou.xyz>
This commit is contained in:
tapiron 2025-09-15 18:30:03 +02:00 committed by Julien Riou
commit e2d3146222

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)