[#134] Support percent-encoding
All checks were successful
/ DCO (pull_request) Successful in 1m15s
/ Builds (1.21) (pull_request) Successful in 1m21s
/ Builds (1.22) (pull_request) Successful in 1m27s
/ Vulncheck (pull_request) Successful in 1m18s
/ Lint (pull_request) Successful in 2m23s
/ Tests (1.21) (pull_request) Successful in 1m37s
/ Tests (1.22) (pull_request) Successful in 1m36s
All checks were successful
/ DCO (pull_request) Successful in 1m15s
/ Builds (1.21) (pull_request) Successful in 1m21s
/ Builds (1.22) (pull_request) Successful in 1m27s
/ Vulncheck (pull_request) Successful in 1m18s
/ Lint (pull_request) Successful in 2m23s
/ Tests (1.21) (pull_request) Successful in 1m37s
/ Tests (1.22) (pull_request) Successful in 1m36s
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
5ee09790f0
commit
fe0bdd4462
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -215,6 +215,12 @@ func (h *Handler) byObjectName(req *fasthttp.RequestCtx, f func(context.Context,
|
|||
log = h.log.With(zap.String("bucketname", bucketname), zap.String("key", key))
|
||||
)
|
||||
|
||||
unescapedKey, err := url.QueryUnescape(key)
|
||||
if err != nil {
|
||||
logAndSendBucketError(req, log, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx := utils.GetContextFromRequest(req)
|
||||
|
||||
bktInfo, err := h.getBucketInfo(ctx, bucketname, log)
|
||||
|
@ -223,7 +229,7 @@ func (h *Handler) byObjectName(req *fasthttp.RequestCtx, f func(context.Context,
|
|||
return
|
||||
}
|
||||
|
||||
foundOid, err := h.tree.GetLatestVersion(ctx, &bktInfo.CID, key)
|
||||
foundOid, err := h.tree.GetLatestVersion(ctx, &bktInfo.CID, unescapedKey)
|
||||
if err != nil {
|
||||
if errors.Is(err, tree.ErrNodeAccessDenied) {
|
||||
response.Error(req, "Access Denied", fasthttp.StatusForbidden)
|
||||
|
|
Loading…
Reference in a new issue