aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_raw.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-22 13:44:03 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-22 13:44:03 +0800
commit99fd8a9cf96a51fcd9e50445cb035cc9ecd012de (patch)
tree077812874d2650216549048524886059391b5d45 /http_handle_repo_raw.go
parentInitial linting (diff)
downloadforge-99fd8a9cf96a51fcd9e50445cb035cc9ecd012de.tar.gz
forge-99fd8a9cf96a51fcd9e50445cb035cc9ecd012de.tar.zst
forge-99fd8a9cf96a51fcd9e50445cb035cc9ecd012de.zip
Variable name lengths
Diffstat (limited to 'http_handle_repo_raw.go')
-rw-r--r--http_handle_repo_raw.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go
index 8664ceb..db20791 100644
--- a/http_handle_repo_raw.go
+++ b/http_handle_repo_raw.go
@@ -13,7 +13,7 @@ import (
"github.com/go-git/go-git/v5/plumbing/object"
)
-func httpHandleRepoRaw(w http.ResponseWriter, r *http.Request, params map[string]any) {
+func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params map[string]any) {
var rawPathSpec, pathSpec string
var repo *git.Repository
var refHash plumbing.Hash
@@ -26,16 +26,16 @@ func httpHandleRepoRaw(w http.ResponseWriter, r *http.Request, params map[string
params["path_spec"] = pathSpec
if refHash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil {
- http.Error(w, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
+ http.Error(writer, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
return
}
if commitObj, err = repo.CommitObject(refHash); err != nil {
- http.Error(w, "Error getting commit object: "+err.Error(), http.StatusInternalServerError)
+ http.Error(writer, "Error getting commit object: "+err.Error(), http.StatusInternalServerError)
return
}
if tree, err = commitObj.Tree(); err != nil {
- http.Error(w, "Error getting file tree: "+err.Error(), http.StatusInternalServerError)
+ http.Error(writer, "Error getting file tree: "+err.Error(), http.StatusInternalServerError)
return
}
@@ -47,26 +47,26 @@ func httpHandleRepoRaw(w http.ResponseWriter, r *http.Request, params map[string
var file *object.File
var fileContent string
if file, err = tree.File(pathSpec); err != nil {
- http.Error(w, "Error retrieving path: "+err.Error(), http.StatusInternalServerError)
+ http.Error(writer, "Error retrieving path: "+err.Error(), http.StatusInternalServerError)
return
}
- if redirectNoDir(w, r) {
+ if redirectNoDir(writer, request) {
return
}
if fileContent, err = file.Contents(); err != nil {
- http.Error(w, "Error reading file: "+err.Error(), http.StatusInternalServerError)
+ http.Error(writer, "Error reading file: "+err.Error(), http.StatusInternalServerError)
return
}
- fmt.Fprint(w, fileContent)
+ fmt.Fprint(writer, fileContent)
return
}
}
- if redirectDir(w, r) {
+ if redirectDir(writer, request) {
return
}
params["files"] = makeDisplayTree(target)
- renderTemplate(w, "repo_raw_dir", params)
+ renderTemplate(writer, "repo_raw_dir", params)
}