server: fix object name trimmed if match with bucket name
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
434b18cff8
commit
e70c29a9ba
1 changed files with 4 additions and 6 deletions
10
server.go
10
server.go
|
|
@ -86,12 +86,10 @@ func (s *server) handle(ctx *fasthttp.RequestCtx) {
|
||||||
path := ctx.Path()
|
path := ctx.Path()
|
||||||
_path := bytes.TrimLeft(path, "/")
|
_path := bytes.TrimLeft(path, "/")
|
||||||
objectName := unsafeByteSliceToString(_path)
|
objectName := unsafeByteSliceToString(_path)
|
||||||
if _, _objectName, found := bytes.Cut(_path, []byte(bucketName)); !isVirtualHostStyle &&
|
|
||||||
bytes.HasPrefix(_path, []byte(bucketName)) &&
|
s.logger.Debugw("handle",
|
||||||
found {
|
"bucket", bucketName,
|
||||||
_objectName = bytes.TrimLeft(_objectName, "/")
|
"objectName", objectName)
|
||||||
objectName = unsafeByteSliceToString(_objectName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if we had access to the object
|
// check if we had access to the object
|
||||||
if _, err := s.opts.S3.StatObject(ctx, bucketName, objectName, minio.GetObjectOptions{}); err != nil {
|
if _, err := s.opts.S3.StatObject(ctx, bucketName, objectName, minio.GetObjectOptions{}); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue