From 2bcff955b1a719dbbe3b99e753b91ca75f604d62 Mon Sep 17 00:00:00 2001
From: Pavel Pogodaev
Date: Mon, 26 Aug 2024 18:47:33 +0300
Subject: [PATCH] [#134] Support percent-encoding
Signed-off-by: Pavel Pogodaev
---
CHANGELOG.md | 1 +
internal/handler/handler.go | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf47b00..8826b71 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
This document outlines major changes between releases.
## [Unreleased]
+- Support percent-encoding for GET queries
## [0.30.0] - Kangshung - 2024-07-22
diff --git a/internal/handler/handler.go b/internal/handler/handler.go
index 0bbcdb9..50ecc3b 100644
--- a/internal/handler/handler.go
+++ b/internal/handler/handler.go
@@ -215,9 +215,15 @@ func (h *Handler) byObjectName(req *fasthttp.RequestCtx, f func(context.Context,
log = h.log.With(zap.String("bucketname", bucketname), zap.String("key", key))
)
+ unescapedName, err := url.QueryUnescape(bucketname)
+ if err != nil {
+ logAndSendBucketError(req, log, err)
+ return
+ }
+
ctx := utils.GetContextFromRequest(req)
- bktInfo, err := h.getBucketInfo(ctx, bucketname, log)
+ bktInfo, err := h.getBucketInfo(ctx, unescapedName, log)
if err != nil {
logAndSendBucketError(req, log, err)
return