gddo: gddo-server: Fix error in layout.html v1 APPLIED

Adnan Maolood: 1
 gddo-server: Fix error in layout.html

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/godocs.io/patches/22558/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gddo] gddo-server: Fix error in layout.html Export this patch

The 'or' function in Go templates does not short-circuit, causing the
.Name field to be evaluated when it does not exist and leading to an
error. Replace it with an if/else statement.
 gddo-server/assets/templates/layout.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gddo-server/assets/templates/layout.html b/gddo-server/assets/templates/layout.html
index fa7e5ac..dbba0fe 100644
--- a/gddo-server/assets/templates/layout.html
+++ b/gddo-server/assets/templates/layout.html
@@ -50,7 +50,7 @@
        <h4 class="modal-title">Keyboard shortcuts</h4>
      <div class="modal-body">
        <table>{{$mutePkg := or (ne "doc.html" templateName) (not .Name) .IsCommand}}
        <table>{{$mutePkg := false}}{{if ne "doc.html" templateName}}{{$mutePkg = true}}{{else if or (not .Name) .IsCommand}}{{$mutePkg = true}}{{end}}
          <tr><td align="right"><b>?</b></td><td> : This menu</td></tr>
          <tr><td align="right"><b>/</b></td><td> : Search site</td></tr>
          <tr{{if $mutePkg}} class="text-muted"{{end}}><td align="right"><b>f</b></td><td> : Jump to identifier</td></tr>
This has bit me before, too. Thanks!

To git@git.sr.ht:~sircmpwn/gddo
   3f3be90..d442d49  master -> master