fix up the view on github thing on unsupported routes

This commit is contained in:
Arya Kiran
2023-05-08 15:47:07 +05:30
parent 61bc243f9b
commit 3e935c889e
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"html/template"
"log"
"os"
"regexp"
"runtime"
"strings"
"time"
"codeberg.org/gothub/gothub/pages"
@@ -45,7 +45,7 @@ func Serve(port string) {
if e, ok := err.(*fiber.Error); ok {
code = e.Code
}
_, link := regexp.MatchString(`\/.*\ `, err.Error())
link := strings.TrimPrefix(err.Error(), "Cannot GET ")
err = ctx.Status(code).Render("error", fiber.Map{
"error": err,
"link": link,
+2
View File
@@ -12,6 +12,8 @@
<a href="https://codeberg.org/gothub/gothub/issues" target="_blank"
>Create an issue on Codeberg.</a
>
{{ if .link }} Or view this page on
<a rel="noreferrer" href="https://github.com{{.link}}">GitHub</a> {{end}}
</h3>
</div>
</main>