diff --git a/main.go b/main.go index 7364637..06e04b5 100644 --- a/main.go +++ b/main.go @@ -122,6 +122,17 @@ func main() { } return res }) + view.AddGlobal("url_encoded_path", func(m interface{}) string { + return url.PathEscape(m.(string)) + + }) + view.AddGlobal("url_decoded_path", func(m interface{}) string { + res, err := url.PathUnescape(m.(string)) + if err != nil { + return m.(string) + } + return res + }) e := echo.New() e.Renderer = &template{View: view} diff --git a/templates/repositories.html b/templates/repositories.html index b49492a..c4c9150 100644 --- a/templates/repositories.html +++ b/templates/repositories.html @@ -48,7 +48,7 @@ {{range repo := repos}} - {{ repo }} + {{ repo }} {{ tagCounts[namespace+"/"+repo] }} {{end}} diff --git a/templates/tag_info.html b/templates/tag_info.html index e9b7cfa..e522383 100644 --- a/templates/tag_info.html +++ b/templates/tag_info.html @@ -8,7 +8,7 @@ {{if namespace != "library"}}
  • {{ namespace }}
  • {{end}} -
  • {{ repo }}
  • +
  • {{ repo |url_decoded_path }}
  • {{ tag }}
  • diff --git a/templates/tags.html b/templates/tags.html index c185578..fb24c70 100644 --- a/templates/tags.html +++ b/templates/tags.html @@ -33,7 +33,7 @@ {{if namespace != "library"}}
  • {{ namespace }}
  • {{end}} -
  • {{ repo }}
  • +
  • {{ repo |url_decoded_path }}