Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

refract: reduce mem alloc while building str (#10261)

jaya16194f5b435
diff --git a/weed/s3api/auth_signature_v4.go b/weed/s3api/auth_signature_v4.go
index 4939baa712..949e8be470 100644
--- a/weed/s3api/auth_signature_v4.go
+++ b/weed/s3api/auth_signature_v4.go
@@ -1123,9 +1123,9 @@ func encodePath(pathName string) string {
if runeLen < 0 {
return pathName
}
- u := make([]byte, runeLen)
- utf8.EncodeRune(u, s)
- for _, r := range u {
+ var u [utf8.UTFMax]byte
+ utf8.EncodeRune(u[:], s)
+ for _, r := range u[:runeLen] {
buf.WriteByte('%')
buf.WriteByte(pathHexTable[r>>4])
buf.WriteByte(pathHexTable[r&0x0f])