diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-11 11:15:42 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-11 11:15:42 +0800 |
commit | 252921635a661a0231ca713565fa37b0faacd793 (patch) | |
tree | 47c2a8d08aa093bffecf9b08bf74d0052aea23e8 /handle_repo_tree.go | |
parent | .editorconfig: Init (diff) | |
download | forge-252921635a661a0231ca713565fa37b0faacd793.tar.gz forge-252921635a661a0231ca713565fa37b0faacd793.tar.zst forge-252921635a661a0231ca713565fa37b0faacd793.zip |
*.go: Reformat
Diffstat (limited to 'handle_repo_tree.go')
-rw-r--r-- | handle_repo_tree.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/handle_repo_tree.go b/handle_repo_tree.go index 4c3eaa1..7a99692 100644 --- a/handle_repo_tree.go +++ b/handle_repo_tree.go @@ -4,8 +4,8 @@ import ( "bytes" "html/template" "net/http" - "strings" "path" + "strings" chroma_formatters_html "github.com/alecthomas/chroma/v2/formatters/html" chroma_lexers "github.com/alecthomas/chroma/v2/lexers" @@ -77,7 +77,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request) { } formatted_encapsulated := template.HTML(formatted_unencapsulated.Bytes()) data["file_contents"] = formatted_encapsulated - + err = templates.ExecuteTemplate(w, "repo_tree_file", data) if err != nil { _, _ = w.Write([]byte("Error rendering template: " + err.Error())) @@ -87,8 +87,8 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request) { } } - if len(raw_path_spec) != 0 && raw_path_spec[len(raw_path_spec) - 1] != '/' { - http.Redirect(w, r, path.Base(path_spec) + "/", http.StatusSeeOther) + if len(raw_path_spec) != 0 && raw_path_spec[len(raw_path_spec)-1] != '/' { + http.Redirect(w, r, path.Base(path_spec)+"/", http.StatusSeeOther) return } |