aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_raw.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-22 13:59:00 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-22 13:59:00 +0800
commit1f185f329bb82c87b250fb2312ae873d69a20d38 (patch)
tree892ad487e7e1154fcb71fbe05acf9e583592e96b /http_handle_repo_raw.go
parentVariable name lengths (diff)
downloadforge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.gz
forge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.zst
forge-1f185f329bb82c87b250fb2312ae873d69a20d38.zip
Use a custom errPage500
Diffstat (limited to 'http_handle_repo_raw.go')
-rw-r--r--http_handle_repo_raw.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go
index db20791..6b69720 100644
--- a/http_handle_repo_raw.go
+++ b/http_handle_repo_raw.go
@@ -26,16 +26,16 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params
params["path_spec"] = pathSpec
if refHash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil {
- http.Error(writer, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error getting ref hash: "+err.Error())
return
}
if commitObj, err = repo.CommitObject(refHash); err != nil {
- http.Error(writer, "Error getting commit object: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error getting commit object: "+err.Error())
return
}
if tree, err = commitObj.Tree(); err != nil {
- http.Error(writer, "Error getting file tree: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error getting file tree: "+err.Error())
return
}
@@ -47,14 +47,14 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params
var file *object.File
var fileContent string
if file, err = tree.File(pathSpec); err != nil {
- http.Error(writer, "Error retrieving path: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error retrieving path: "+err.Error())
return
}
if redirectNoDir(writer, request) {
return
}
if fileContent, err = file.Contents(); err != nil {
- http.Error(writer, "Error reading file: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error reading file: "+err.Error())
return
}
fmt.Fprint(writer, fileContent)