forked from TrueCloudLab/frostfs-s3-gw
[#313] Remove extra QueryUnescapes
Removed extra QueryUnescapes in search and objectPut Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
4f5b316211
commit
1502857dba
1 changed files with 5 additions and 16 deletions
|
@ -3,7 +3,6 @@ package layer
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"net/url"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -88,17 +87,11 @@ func (n *layer) objectSearch(ctx context.Context, p *findParams) ([]*object.ID,
|
||||||
opts.AddRootFilter()
|
opts.AddRootFilter()
|
||||||
|
|
||||||
for _, filter := range p.filters {
|
for _, filter := range p.filters {
|
||||||
if val, err := url.QueryUnescape(filter.val); err != nil {
|
opts.AddFilter(filter.attr, filter.val, object.MatchStringEqual)
|
||||||
return nil, err
|
|
||||||
} else if val != "" {
|
|
||||||
opts.AddFilter(filter.attr, val, object.MatchStringEqual)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if prefix, err := url.QueryUnescape(p.prefix); err != nil {
|
if p.prefix != "" {
|
||||||
return nil, err
|
opts.AddFilter(object.AttributeFileName, p.prefix, object.MatchCommonPrefix)
|
||||||
} else if prefix != "" {
|
|
||||||
opts.AddFilter(object.AttributeFileName, prefix, object.MatchCommonPrefix)
|
|
||||||
}
|
}
|
||||||
searchParams := new(client.SearchObjectParams).WithContainerID(p.cid).WithSearchFilters(opts)
|
searchParams := new(client.SearchObjectParams).WithContainerID(p.cid).WithSearchFilters(opts)
|
||||||
|
|
||||||
|
@ -147,13 +140,9 @@ func (n *layer) objectRange(ctx context.Context, p *getParams) ([]byte, error) {
|
||||||
// objectPut into NeoFS, took payload from io.Reader.
|
// objectPut into NeoFS, took payload from io.Reader.
|
||||||
func (n *layer) objectPut(ctx context.Context, bkt *data.BucketInfo, p *PutObjectParams) (*data.ObjectInfo, error) {
|
func (n *layer) objectPut(ctx context.Context, bkt *data.BucketInfo, p *PutObjectParams) (*data.ObjectInfo, error) {
|
||||||
own := n.Owner(ctx)
|
own := n.Owner(ctx)
|
||||||
obj, err := url.QueryUnescape(p.Object)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
versioningEnabled := n.isVersioningEnabled(ctx, bkt)
|
versioningEnabled := n.isVersioningEnabled(ctx, bkt)
|
||||||
versions, err := n.headVersions(ctx, bkt, obj)
|
versions, err := n.headVersions(ctx, bkt, p.Object)
|
||||||
if err != nil && !apiErrors.IsS3Error(err, apiErrors.ErrNoSuchKey) {
|
if err != nil && !apiErrors.IsS3Error(err, apiErrors.ErrNoSuchKey) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -169,7 +158,7 @@ func (n *layer) objectPut(ctx context.Context, bkt *data.BucketInfo, p *PutObjec
|
||||||
r = d.MultiReader()
|
r = d.MultiReader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rawObject := formRawObject(p, bkt.CID, own, obj)
|
rawObject := formRawObject(p, bkt.CID, own, p.Object)
|
||||||
|
|
||||||
ops := new(client.PutObjectParams).WithObject(rawObject.Object()).WithPayloadReader(r)
|
ops := new(client.PutObjectParams).WithObject(rawObject.Object()).WithPayloadReader(r)
|
||||||
oid, err := n.pool.PutObject(ctx, ops, n.CallOptions(ctx)...)
|
oid, err := n.pool.PutObject(ctx, ops, n.CallOptions(ctx)...)
|
||||||
|
|
Loading…
Reference in a new issue