Fixing “can’t give argument to non-function not $.DisableHTTP” in Gitea Wiki pages

I ran into an issue where trying to view a wiki page in Gitea threw an error:

template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP

This issue was fixed in Gitea 1.11.4, so you’re probably running 1.11.3 or before. The latest version of the Gitea plugin in FreeNAS, at time of writing, contains version 1.11.5, which fixes the issue. You can just go into the plugins page, click the arrow to the right of your Gitea installation, and click the Update button.

If you can’t upgrade the plugin for some reason, or need to manually fix it, here are the steps:

  1. SSH into your FreeNAS system.
  2. Run iocage console gitea, replacing “gitea” with the name of your gitea plugin jail.
  3. Edit /usr/local/share/gitea/templates/repo/wiki/view.tmpl and on line 48 (depending on version) remove the outer set of parenthesis around the if or ((not $.DisableHTTP) ... ))}} part of the code – see this commit for exact details of what should be changed.
  4. Save the file.
  5. Restart the gitea service: service gitea restart

You should now be able to view the wiki again.