forked from jriou/coller
fix: display error page if note not found (#24)
Fix panic when trying to access a non existing note with the "pretty" url (.html) Reviewed-on: jriou/coller#24 Reviewed-by: Julien Riou <jriou@monitoring@riou.xyz> Co-authored-by: Thibault Piron <thibault.piron.ext@ovhcloud.com> Co-committed-by: Thibault Piron <thibault.piron.ext@ovhcloud.com>
This commit is contained in:
parent
792eff78cc
commit
af5baa999c
1 changed files with 6 additions and 0 deletions
|
@ -377,6 +377,12 @@ func (h *GetProtectedWebNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Re
|
|||
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 password != "" && note.Encrypted {
|
||||
note.Content, err = internal.Decrypt(note.Content, password)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue