diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 14:09:15 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 14:09:15 +0800 |
commit | 98826d198b228e725ceb5a9fcf1d936ad3817d8e (patch) | |
tree | ba1840795c2b46529128945f80a548f11daf9c00 /http_handle_repo_raw.go | |
parent | Reduce allocations when converting string to []byte (diff) | |
download | forge-79b504ab791db5e53d813d94ac2b2b3719da97d6.tar.gz forge-79b504ab791db5e53d813d94ac2b2b3719da97d6.tar.zst forge-79b504ab791db5e53d813d94ac2b2b3719da97d6.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.go | 4 |
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)) |