2021-04-18 12:41:13 -07:00
|
|
|
// Copyright (c) 2015-2021 MinIO, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of MinIO Object Storage stack
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-07-17 12:32:05 -07:00
|
|
|
|
2016-08-18 16:23:42 -07:00
|
|
|
package cmd
|
2016-07-17 12:32:05 -07:00
|
|
|
|
|
|
|
import (
|
2020-07-02 10:56:22 -07:00
|
|
|
"context"
|
2016-07-17 12:32:05 -07:00
|
|
|
"net/http"
|
2020-07-03 19:53:03 +01:00
|
|
|
"strconv"
|
2019-02-24 07:14:24 +01:00
|
|
|
"strings"
|
2016-07-17 12:32:05 -07:00
|
|
|
|
2021-06-01 14:59:40 -07:00
|
|
|
"github.com/minio/minio/internal/logger"
|
2023-01-23 16:42:47 +05:30
|
|
|
"github.com/minio/mux"
|
2018-08-17 12:52:14 -07:00
|
|
|
|
2023-09-04 12:57:37 -07:00
|
|
|
"github.com/minio/pkg/v2/policy"
|
2016-07-17 12:32:05 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
// Validate all the ListObjects query arguments, returns an APIErrorCode
|
|
|
|
// if one of the args do not meet the required conditions.
|
2019-04-09 11:39:42 -07:00
|
|
|
// Special conditions required by MinIO server are as below
|
2022-08-26 12:52:29 -07:00
|
|
|
// - delimiter if set should be equal to '/', otherwise the request is rejected.
|
|
|
|
// - marker if set should have a common prefix with 'prefix' param, otherwise
|
|
|
|
// the request is rejected.
|
2022-11-08 22:29:05 +01:00
|
|
|
func validateListObjectsArgs(prefix, marker, delimiter, encodingType string, maxKeys int) APIErrorCode {
|
2016-07-17 12:32:05 -07:00
|
|
|
// Max keys cannot be negative.
|
|
|
|
if maxKeys < 0 {
|
|
|
|
return ErrInvalidMaxKeys
|
|
|
|
}
|
|
|
|
|
2019-02-24 07:14:24 +01:00
|
|
|
if encodingType != "" {
|
2021-11-16 09:28:29 -08:00
|
|
|
// AWS S3 spec only supports 'url' encoding type
|
|
|
|
if !strings.EqualFold(encodingType, "url") {
|
2019-02-24 07:14:24 +01:00
|
|
|
return ErrInvalidEncodingMethod
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-08 22:29:05 +01:00
|
|
|
if !IsValidObjectPrefix(prefix) {
|
|
|
|
return ErrInvalidObjectName
|
|
|
|
}
|
|
|
|
|
|
|
|
if marker != "" && !HasPrefix(marker, prefix) {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
return ErrNone
|
|
|
|
}
|
|
|
|
|
2023-03-30 12:20:42 -07:00
|
|
|
func (api objectAPIHandlers) ListObjectVersionsHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
api.listObjectVersionsHandler(w, r, false)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (api objectAPIHandlers) ListObjectVersionsMHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
api.listObjectVersionsHandler(w, r, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListObjectVersionsHandler - GET Bucket Object versions
|
2019-08-19 11:02:54 -10:00
|
|
|
// You can use the versions subresource to list metadata about all
|
|
|
|
// of the versions of objects in a bucket.
|
2023-03-30 12:20:42 -07:00
|
|
|
func (api objectAPIHandlers) listObjectVersionsHandler(w http.ResponseWriter, r *http.Request, metadata bool) {
|
2020-06-12 20:04:01 -07:00
|
|
|
ctx := newContext(r, w, "ListObjectVersions")
|
2019-08-19 11:02:54 -10:00
|
|
|
|
2021-01-26 22:21:51 +01:00
|
|
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
2019-08-19 11:02:54 -10:00
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
|
|
|
objectAPI := api.ObjectAPI()
|
|
|
|
if objectAPI == nil {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
2019-08-19 11:02:54 -10:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-09-03 18:25:06 -07:00
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.ListBucketVersionsAction, bucket, ""); s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2019-08-19 11:02:54 -10:00
|
|
|
return
|
|
|
|
}
|
2023-04-06 07:52:35 -07:00
|
|
|
var checkObjMeta metaCheckFn
|
|
|
|
if metadata {
|
|
|
|
checkObjMeta = func(name string, action policy.Action) (s3Err APIErrorCode) {
|
|
|
|
return checkRequestAuthType(ctx, r, action, bucket, name)
|
|
|
|
}
|
|
|
|
}
|
2021-08-07 22:43:01 -07:00
|
|
|
urlValues := r.Form
|
2019-08-19 11:02:54 -10:00
|
|
|
|
|
|
|
// Extract all the listBucketVersions query params to their native values.
|
2020-06-12 20:04:01 -07:00
|
|
|
prefix, marker, delimiter, maxkeys, encodingType, versionIDMarker, errCode := getListBucketObjectVersionsArgs(urlValues)
|
2019-08-19 11:02:54 -10:00
|
|
|
if errCode != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(errCode), r.URL)
|
2019-08-19 11:02:54 -10:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate the query params before beginning to serve the request.
|
2022-11-08 22:29:05 +01:00
|
|
|
if s3Error := validateListObjectsArgs(prefix, marker, delimiter, encodingType, maxkeys); s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2019-08-19 11:02:54 -10:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-06-12 20:04:01 -07:00
|
|
|
listObjectVersions := objectAPI.ListObjectVersions
|
2019-08-19 11:02:54 -10:00
|
|
|
|
2020-06-12 20:04:01 -07:00
|
|
|
// Inititate a list object versions operation based on the input params.
|
2019-08-19 11:02:54 -10:00
|
|
|
// On success would return back ListObjectsInfo object to be
|
|
|
|
// marshaled into S3 compatible XML header.
|
2020-06-12 20:04:01 -07:00
|
|
|
listObjectVersionsInfo, err := listObjectVersions(ctx, bucket, prefix, marker, versionIDMarker, delimiter, maxkeys)
|
2019-08-19 11:02:54 -10:00
|
|
|
if err != nil {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
2019-08-19 11:02:54 -10:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-04-04 20:42:03 +02:00
|
|
|
if err = DecryptETags(ctx, GlobalKMS, listObjectVersionsInfo.Objects); err != nil {
|
2022-03-25 23:01:41 +01:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
2023-04-06 07:52:35 -07:00
|
|
|
response := generateListVersionsResponse(bucket, prefix, marker, versionIDMarker, delimiter, encodingType, maxkeys, listObjectVersionsInfo, checkObjMeta)
|
2019-08-19 11:02:54 -10:00
|
|
|
|
|
|
|
// Write success response.
|
2023-01-17 05:08:33 +05:30
|
|
|
writeSuccessResponseXML(w, encodeResponseList(response))
|
2019-08-19 11:02:54 -10:00
|
|
|
}
|
|
|
|
|
2019-11-21 01:54:49 -08:00
|
|
|
// ListObjectsV2MHandler - GET Bucket (List Objects) Version 2 with metadata.
|
|
|
|
// --------------------------
|
2021-08-31 17:18:13 -07:00
|
|
|
// This implementation of the GET operation returns some or all (up to 1000)
|
2020-10-28 09:18:35 -07:00
|
|
|
// of the objects in a bucket. You can use the request parameters as selection
|
2019-11-21 01:54:49 -08:00
|
|
|
// criteria to return a subset of the objects in a bucket.
|
|
|
|
//
|
|
|
|
// NOTE: It is recommended that this API to be used for application development.
|
|
|
|
// MinIO continues to support ListObjectsV1 and V2 for supporting legacy tools.
|
|
|
|
func (api objectAPIHandlers) ListObjectsV2MHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
ctx := newContext(r, w, "ListObjectsV2M")
|
2023-04-06 07:52:35 -07:00
|
|
|
api.listObjectsV2Handler(ctx, w, r, true)
|
2019-11-21 01:54:49 -08:00
|
|
|
}
|
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
// ListObjectsV2Handler - GET Bucket (List Objects) Version 2.
|
|
|
|
// --------------------------
|
2021-08-31 17:18:13 -07:00
|
|
|
// This implementation of the GET operation returns some or all (up to 1000)
|
2016-07-17 12:32:05 -07:00
|
|
|
// of the objects in a bucket. You can use the request parameters as selection
|
|
|
|
// criteria to return a subset of the objects in a bucket.
|
|
|
|
//
|
|
|
|
// NOTE: It is recommended that this API to be used for application development.
|
2019-04-09 11:39:42 -07:00
|
|
|
// MinIO continues to support ListObjectsV1 for supporting legacy tools.
|
2016-07-17 12:32:05 -07:00
|
|
|
func (api objectAPIHandlers) ListObjectsV2Handler(w http.ResponseWriter, r *http.Request) {
|
2018-07-20 18:46:32 -07:00
|
|
|
ctx := newContext(r, w, "ListObjectsV2")
|
2023-04-06 07:52:35 -07:00
|
|
|
api.listObjectsV2Handler(ctx, w, r, false)
|
|
|
|
}
|
2018-03-14 12:01:47 -07:00
|
|
|
|
2023-04-06 07:52:35 -07:00
|
|
|
// listObjectsV2Handler performs listing either with or without extra metadata.
|
|
|
|
func (api objectAPIHandlers) listObjectsV2Handler(ctx context.Context, w http.ResponseWriter, r *http.Request, metadata bool) {
|
2021-01-26 22:21:51 +01:00
|
|
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
2018-10-12 12:25:59 -07:00
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
2016-08-10 18:47:49 -07:00
|
|
|
objectAPI := api.ObjectAPI()
|
|
|
|
if objectAPI == nil {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
2016-08-10 18:47:49 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-25 04:23:30 +05:30
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.ListBucketAction, bucket, ""); s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 12:32:05 -07:00
|
|
|
return
|
|
|
|
}
|
2016-11-21 13:51:05 -08:00
|
|
|
|
2023-04-06 07:52:35 -07:00
|
|
|
var checkObjMeta metaCheckFn
|
|
|
|
if metadata {
|
|
|
|
checkObjMeta = func(name string, action policy.Action) (s3Err APIErrorCode) {
|
|
|
|
return checkRequestAuthType(ctx, r, action, bucket, name)
|
|
|
|
}
|
|
|
|
}
|
2021-08-07 22:43:01 -07:00
|
|
|
urlValues := r.Form
|
2018-06-26 01:05:43 +05:30
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
// Extract all the listObjectsV2 query params to their native values.
|
2019-02-24 07:14:24 +01:00
|
|
|
prefix, token, startAfter, delimiter, fetchOwner, maxKeys, encodingType, errCode := getListObjectsV2Args(urlValues)
|
2018-06-26 01:05:43 +05:30
|
|
|
if errCode != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(errCode), r.URL)
|
2018-06-26 01:05:43 +05:30
|
|
|
return
|
|
|
|
}
|
2016-07-17 12:32:05 -07:00
|
|
|
|
2016-09-10 18:44:38 +01:00
|
|
|
// Validate the query params before beginning to serve the request.
|
2022-11-08 22:29:05 +01:00
|
|
|
if s3Error := validateListObjectsArgs(prefix, token, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 12:32:05 -07:00
|
|
|
return
|
|
|
|
}
|
2019-02-12 01:25:52 -08:00
|
|
|
|
2021-06-10 16:17:03 +01:00
|
|
|
var (
|
|
|
|
listObjectsV2Info ListObjectsV2Info
|
|
|
|
err error
|
|
|
|
)
|
|
|
|
|
|
|
|
if r.Header.Get(xMinIOExtract) == "true" && strings.Contains(prefix, archivePattern) {
|
|
|
|
// Inititate a list objects operation inside a zip file based in the input params
|
|
|
|
listObjectsV2Info, err = listObjectsV2InArchive(ctx, objectAPI, bucket, prefix, token, delimiter, maxKeys, fetchOwner, startAfter)
|
|
|
|
} else {
|
|
|
|
// Inititate a list objects operation based on the input params.
|
|
|
|
// On success would return back ListObjectsInfo object to be
|
|
|
|
// marshaled into S3 compatible XML header.
|
|
|
|
listObjectsV2Info, err = objectAPI.ListObjectsV2(ctx, bucket, prefix, token, delimiter, maxKeys, fetchOwner, startAfter)
|
|
|
|
}
|
2016-07-17 12:32:05 -07:00
|
|
|
if err != nil {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
2016-07-17 12:32:05 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-04-04 20:42:03 +02:00
|
|
|
if err = DecryptETags(ctx, GlobalKMS, listObjectsV2Info.Objects); err != nil {
|
2022-03-25 23:01:41 +01:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
2018-03-01 20:37:57 +01:00
|
|
|
|
2020-10-28 09:18:35 -07:00
|
|
|
response := generateListObjectsV2Response(bucket, prefix, token, listObjectsV2Info.NextContinuationToken, startAfter,
|
2019-11-21 01:54:49 -08:00
|
|
|
delimiter, encodingType, fetchOwner, listObjectsV2Info.IsTruncated,
|
2023-04-06 07:52:35 -07:00
|
|
|
maxKeys, listObjectsV2Info.Objects, listObjectsV2Info.Prefixes, checkObjMeta)
|
2017-01-06 00:37:00 -08:00
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
// Write success response.
|
2023-01-17 05:08:33 +05:30
|
|
|
writeSuccessResponseXML(w, encodeResponseList(response))
|
2016-07-17 12:32:05 -07:00
|
|
|
}
|
|
|
|
|
2020-07-03 19:27:13 -07:00
|
|
|
func parseRequestToken(token string) (subToken string, nodeIndex int) {
|
|
|
|
if token == "" {
|
|
|
|
return token, -1
|
|
|
|
}
|
2023-08-11 13:12:35 -07:00
|
|
|
i := strings.Index(token, ":")
|
2020-07-03 19:53:03 +01:00
|
|
|
if i < 0 {
|
2020-07-03 19:27:13 -07:00
|
|
|
return token, -1
|
2020-07-03 19:53:03 +01:00
|
|
|
}
|
|
|
|
nodeIndex, err := strconv.Atoi(token[i+1:])
|
|
|
|
if err != nil {
|
2020-07-03 19:27:13 -07:00
|
|
|
return token, -1
|
2020-07-02 10:56:22 -07:00
|
|
|
}
|
2020-07-03 19:53:03 +01:00
|
|
|
subToken = token[:i]
|
2020-07-03 19:27:13 -07:00
|
|
|
return subToken, nodeIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
func proxyRequestByToken(ctx context.Context, w http.ResponseWriter, r *http.Request, token string) (string, bool) {
|
|
|
|
subToken, nodeIndex := parseRequestToken(token)
|
|
|
|
if nodeIndex > 0 {
|
|
|
|
return subToken, proxyRequestByNodeIndex(ctx, w, r, nodeIndex)
|
|
|
|
}
|
|
|
|
return subToken, false
|
2020-07-03 19:53:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func proxyRequestByNodeIndex(ctx context.Context, w http.ResponseWriter, r *http.Request, index int) (success bool) {
|
|
|
|
if len(globalProxyEndpoints) == 0 {
|
2020-07-02 10:56:22 -07:00
|
|
|
return false
|
|
|
|
}
|
2020-07-03 19:53:03 +01:00
|
|
|
if index < 0 || index >= len(globalProxyEndpoints) {
|
2020-07-02 10:56:22 -07:00
|
|
|
return false
|
|
|
|
}
|
2020-07-03 19:53:03 +01:00
|
|
|
ep := globalProxyEndpoints[index]
|
|
|
|
if ep.IsLocal {
|
|
|
|
return false
|
2020-07-02 10:56:22 -07:00
|
|
|
}
|
2020-07-03 19:53:03 +01:00
|
|
|
return proxyRequest(ctx, w, r, ep)
|
|
|
|
}
|
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
// ListObjectsV1Handler - GET Bucket (List Objects) Version 1.
|
|
|
|
// --------------------------
|
2021-08-31 17:18:13 -07:00
|
|
|
// This implementation of the GET operation returns some or all (up to 1000)
|
2016-07-17 12:32:05 -07:00
|
|
|
// of the objects in a bucket. You can use the request parameters as selection
|
|
|
|
// criteria to return a subset of the objects in a bucket.
|
|
|
|
func (api objectAPIHandlers) ListObjectsV1Handler(w http.ResponseWriter, r *http.Request) {
|
2018-07-20 18:46:32 -07:00
|
|
|
ctx := newContext(r, w, "ListObjectsV1")
|
2018-03-14 12:01:47 -07:00
|
|
|
|
2021-01-26 22:21:51 +01:00
|
|
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
2018-10-12 12:25:59 -07:00
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
2016-08-10 18:47:49 -07:00
|
|
|
objectAPI := api.ObjectAPI()
|
|
|
|
if objectAPI == nil {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
2016-08-10 18:47:49 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-25 04:23:30 +05:30
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.ListBucketAction, bucket, ""); s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 12:32:05 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extract all the litsObjectsV1 query params to their native values.
|
2021-08-07 22:43:01 -07:00
|
|
|
prefix, marker, delimiter, maxKeys, encodingType, s3Error := getListObjectsV1Args(r.Form)
|
2018-10-18 16:31:46 +02:00
|
|
|
if s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2018-10-18 16:31:46 +02:00
|
|
|
return
|
|
|
|
}
|
2016-07-17 12:32:05 -07:00
|
|
|
|
2019-02-12 01:25:52 -08:00
|
|
|
// Validate all the query params before beginning to serve the request.
|
2022-11-08 22:29:05 +01:00
|
|
|
if s3Error := validateListObjectsArgs(prefix, marker, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 12:32:05 -07:00
|
|
|
return
|
|
|
|
}
|
2019-02-12 01:25:52 -08:00
|
|
|
|
2018-03-28 14:14:06 -07:00
|
|
|
listObjects := objectAPI.ListObjects
|
2019-02-12 01:25:52 -08:00
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
// Inititate a list objects operation based on the input params.
|
|
|
|
// On success would return back ListObjectsInfo object to be
|
2018-06-28 16:02:02 -07:00
|
|
|
// marshaled into S3 compatible XML header.
|
2018-03-28 14:14:06 -07:00
|
|
|
listObjectsInfo, err := listObjects(ctx, bucket, prefix, marker, delimiter, maxKeys)
|
2016-07-17 12:32:05 -07:00
|
|
|
if err != nil {
|
2021-06-17 20:27:04 -07:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
2016-07-17 12:32:05 -07:00
|
|
|
return
|
|
|
|
}
|
2018-03-01 20:37:57 +01:00
|
|
|
|
2022-04-04 20:42:03 +02:00
|
|
|
if err = DecryptETags(ctx, GlobalKMS, listObjectsInfo.Objects); err != nil {
|
2022-03-25 23:01:41 +01:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
2020-05-24 11:19:17 -07:00
|
|
|
|
2019-02-24 07:14:24 +01:00
|
|
|
response := generateListObjectsV1Response(bucket, prefix, marker, delimiter, encodingType, maxKeys, listObjectsInfo)
|
2017-01-06 00:37:00 -08:00
|
|
|
|
2016-07-17 12:32:05 -07:00
|
|
|
// Write success response.
|
2023-01-17 05:08:33 +05:30
|
|
|
writeSuccessResponseXML(w, encodeResponseList(response))
|
2016-07-17 12:32:05 -07:00
|
|
|
}
|