~migadu/alps#151: 
HTTP 500 when logging in with an account missing one of the CategorizedMailboxes

Reproduce :

  • Use theme alps on latest git version
  • Login to an account without at least one of the CategorizedMailboxes (Inbox, Drafts, Sent, Junk, Trash, Archive)

Expected behaviour:

  • Show the mailboxes screen

Actual bahaviour:

  • A HTTP 500 page is shown
  • The following line is printed in the console : "ERROR template: util.html:2:16: executing "mbox-link" at <.Info.HasAttr>: error calling HasAttr: runtime error: invalid memory address or nil pointer dereference"

The "aside" template (util.html, line 34) does not check if the categorized mailboxes exist before calling template "mbox-link" on each one of them, thus leading to a nil pointer dereference of attribute Info in "mbox-link" if the mailbox does not exist.

A patch proposal fixing this is linked to this report. Greetings,

Florian Le Minoux

Status
REPORTED
Submitter
Florian Le Minoux
Assigned to
No-one
Submitted
1 year, 10 months ago
Updated
1 year, 10 months ago
Labels
No labels applied.

Florian Le Minoux 1 year, 10 months ago · edit

I missed my attachment apparently, so i'll put it below :

diff --git a/themes/alps/util.html b/themes/alps/util.html
index 9cdfd86..b0022ec 100644
--- a/themes/alps/util.html
+++ b/themes/alps/util.html
@@ -32,12 +32,12 @@
       ">Compose&nbsp;mail</a>
     </li>
     {{ with .CategorizedMailboxes }}
-    {{ with .Common.Inbox }}{{ template "mbox-link" . }}{{ end }}
-    {{ with .Common.Drafts }}{{ template "mbox-link" . }}{{ end }}
-    {{ with .Common.Sent }}{{ template "mbox-link" . }}{{ end }}
-    {{ with .Common.Junk }}{{ template "mbox-link" . }}{{ end }}
-    {{ with .Common.Trash }}{{ template "mbox-link" . }}{{ end }}
-    {{ with .Common.Archive }}{{ template "mbox-link" . }}{{ end }}
+    {{ if .Common.Inbox.Info }}{{ with .Common.Inbox }}{{ template "mbox-link" . }}{{ end }}{{ end }}
+    {{ if .Common.Drafts.Info }}{{ with .Common.Drafts }}{{ template "mbox-link" . }}{{ end }}{{ end }}
+    {{ if .Common.Sent.Info }}{{ with .Common.Sent }}{{ template "mbox-link" . }}{{ end }}{{ end }}
+    {{ if .Common.Junk.Info }}{{ with .Common.Junk }}{{ template "mbox-link" . }}{{ end }}{{ end }}
+    {{ if .Common.Trash.Info }}{{ with .Common.Trash }}{{ template "mbox-link" . }}{{ end }}{{ end }}
+    {{ if .Common.Archive.Info }}{{ with .Common.Archive }}{{ template "mbox-link" . }}{{ end }}{{ end }}
     {{ if .Additional }}
     <hr />
     {{ range .Additional }}

Sorry about that

weston@kk6mrp.com 1 year, 10 months ago · edit

This patch is working for me. Thank You!

Register here or Log in to comment, or comment via email.