aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_raw.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 14:09:15 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 14:09:15 +0800
commit98826d198b228e725ceb5a9fcf1d936ad3817d8e (patch)
treeba1840795c2b46529128945f80a548f11daf9c00 /http_handle_repo_raw.go
parentReduce allocations when converting string to []byte (diff)
downloadforge-0.1.22.tar.gz
forge-0.1.22.tar.zst
forge-0.1.22.zip
Reduce unnecessary allocations when converting []byte to stringv0.1.22
Diffstat (limited to 'http_handle_repo_raw.go')
-rw-r--r--http_handle_repo_raw.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go
index 5c8f626..d12fa39 100644
--- a/http_handle_repo_raw.go
+++ b/http_handle_repo_raw.go
@@ -98,7 +98,7 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params
return
}
files = append(files, displayTreeEntry{
- Name: string(name),
+ Name: bytesToString(name),
Mode: fmt.Sprintf("%06o", mode),
Size: size,
IsFile: typeCode == 2,
@@ -123,7 +123,7 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params
return
}
writer.Header().Set("Content-Type", "application/octet-stream")
- fmt.Fprint(writer, string(content))
+ fmt.Fprint(writer, bytesToString(content))
default:
errorPage500(writer, params, fmt.Sprintf("unknown object kind: %d", kind))