2021-04-18 15:41:13 -04: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 15:32:05 -04:00
|
|
|
|
2016-08-18 19:23:42 -04:00
|
|
|
package cmd
|
2016-07-17 15:32:05 -04:00
|
|
|
|
|
|
|
import (
|
2020-07-02 13:56:22 -04:00
|
|
|
"context"
|
2016-07-17 15:32:05 -04:00
|
|
|
"net/http"
|
2020-07-03 14:53:03 -04:00
|
|
|
"strconv"
|
2019-02-24 01:14:24 -05:00
|
|
|
"strings"
|
2016-07-17 15:32:05 -04:00
|
|
|
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/logger"
|
2023-01-23 06:12:47 -05:00
|
|
|
"github.com/minio/mux"
|
2018-08-17 15:52:14 -04:00
|
|
|
|
2023-09-04 15:57:37 -04:00
|
|
|
"github.com/minio/pkg/v2/policy"
|
2016-07-17 15:32:05 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Validate all the ListObjects query arguments, returns an APIErrorCode
|
|
|
|
// if one of the args do not meet the required conditions.
|
2019-04-09 14:39:42 -04:00
|
|
|
// Special conditions required by MinIO server are as below
|
2022-08-26 15:52:29 -04: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 16:29:05 -05:00
|
|
|
func validateListObjectsArgs(prefix, marker, delimiter, encodingType string, maxKeys int) APIErrorCode {
|
2016-07-17 15:32:05 -04:00
|
|
|
// Max keys cannot be negative.
|
|
|
|
if maxKeys < 0 {
|
|
|
|
return ErrInvalidMaxKeys
|
|
|
|
}
|
|
|
|
|
2019-02-24 01:14:24 -05:00
|
|
|
if encodingType != "" {
|
2021-11-16 12:28:29 -05:00
|
|
|
// AWS S3 spec only supports 'url' encoding type
|
|
|
|
if !strings.EqualFold(encodingType, "url") {
|
2019-02-24 01:14:24 -05:00
|
|
|
return ErrInvalidEncodingMethod
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-08 16:29:05 -05:00
|
|
|
if !IsValidObjectPrefix(prefix) {
|
|
|
|
return ErrInvalidObjectName
|
|
|
|
}
|
|
|
|
|
|
|
|
if marker != "" && !HasPrefix(marker, prefix) {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
return ErrNone
|
|
|
|
}
|
|
|
|
|
2023-03-30 15:20:42 -04: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 17:02:54 -04:00
|
|
|
// You can use the versions subresource to list metadata about all
|
|
|
|
// of the versions of objects in a bucket.
|
2023-03-30 15:20:42 -04:00
|
|
|
func (api objectAPIHandlers) listObjectVersionsHandler(w http.ResponseWriter, r *http.Request, metadata bool) {
|
2020-06-12 23:04:01 -04:00
|
|
|
ctx := newContext(r, w, "ListObjectVersions")
|
2019-08-19 17:02:54 -04:00
|
|
|
|
2021-01-26 16:21:51 -05:00
|
|
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
2019-08-19 17:02:54 -04:00
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
|
|
|
objectAPI := api.ObjectAPI()
|
|
|
|
if objectAPI == nil {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
2019-08-19 17:02:54 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-09-03 21:25:06 -04:00
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.ListBucketVersionsAction, bucket, ""); s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2019-08-19 17:02:54 -04:00
|
|
|
return
|
|
|
|
}
|
2023-04-06 10:52:35 -04:00
|
|
|
var checkObjMeta metaCheckFn
|
|
|
|
if metadata {
|
|
|
|
checkObjMeta = func(name string, action policy.Action) (s3Err APIErrorCode) {
|
|
|
|
return checkRequestAuthType(ctx, r, action, bucket, name)
|
|
|
|
}
|
|
|
|
}
|
2021-08-08 01:43:01 -04:00
|
|
|
urlValues := r.Form
|
2019-08-19 17:02:54 -04:00
|
|
|
|
|
|
|
// Extract all the listBucketVersions query params to their native values.
|
2020-06-12 23:04:01 -04:00
|
|
|
prefix, marker, delimiter, maxkeys, encodingType, versionIDMarker, errCode := getListBucketObjectVersionsArgs(urlValues)
|
2019-08-19 17:02:54 -04:00
|
|
|
if errCode != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(errCode), r.URL)
|
2019-08-19 17:02:54 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate the query params before beginning to serve the request.
|
2022-11-08 16:29:05 -05:00
|
|
|
if s3Error := validateListObjectsArgs(prefix, marker, delimiter, encodingType, maxkeys); s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2019-08-19 17:02:54 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-06-12 23:04:01 -04:00
|
|
|
listObjectVersions := objectAPI.ListObjectVersions
|
2019-08-19 17:02:54 -04:00
|
|
|
|
2024-01-18 02:03:17 -05:00
|
|
|
// Initiate a list object versions operation based on the input params.
|
2019-08-19 17:02:54 -04:00
|
|
|
// On success would return back ListObjectsInfo object to be
|
|
|
|
// marshaled into S3 compatible XML header.
|
2020-06-12 23:04:01 -04:00
|
|
|
listObjectVersionsInfo, err := listObjectVersions(ctx, bucket, prefix, marker, versionIDMarker, delimiter, maxkeys)
|
2019-08-19 17:02:54 -04:00
|
|
|
if err != nil {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
2019-08-19 17:02:54 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-04-04 14:42:03 -04:00
|
|
|
if err = DecryptETags(ctx, GlobalKMS, listObjectVersionsInfo.Objects); err != nil {
|
2022-03-25 18:01:41 -04:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
2023-04-06 10:52:35 -04:00
|
|
|
response := generateListVersionsResponse(bucket, prefix, marker, versionIDMarker, delimiter, encodingType, maxkeys, listObjectVersionsInfo, checkObjMeta)
|
2019-08-19 17:02:54 -04:00
|
|
|
|
|
|
|
// Write success response.
|
2023-01-16 18:38:33 -05:00
|
|
|
writeSuccessResponseXML(w, encodeResponseList(response))
|
2019-08-19 17:02:54 -04:00
|
|
|
}
|
|
|
|
|
2019-11-21 04:54:49 -05:00
|
|
|
// ListObjectsV2MHandler - GET Bucket (List Objects) Version 2 with metadata.
|
|
|
|
// --------------------------
|
2021-08-31 20:18:13 -04:00
|
|
|
// This implementation of the GET operation returns some or all (up to 1000)
|
2020-10-28 12:18:35 -04:00
|
|
|
// of the objects in a bucket. You can use the request parameters as selection
|
2019-11-21 04:54:49 -05: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 10:52:35 -04:00
|
|
|
api.listObjectsV2Handler(ctx, w, r, true)
|
2019-11-21 04:54:49 -05:00
|
|
|
}
|
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
// ListObjectsV2Handler - GET Bucket (List Objects) Version 2.
|
|
|
|
// --------------------------
|
2021-08-31 20:18:13 -04:00
|
|
|
// This implementation of the GET operation returns some or all (up to 1000)
|
2016-07-17 15:32:05 -04: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 14:39:42 -04:00
|
|
|
// MinIO continues to support ListObjectsV1 for supporting legacy tools.
|
2016-07-17 15:32:05 -04:00
|
|
|
func (api objectAPIHandlers) ListObjectsV2Handler(w http.ResponseWriter, r *http.Request) {
|
2018-07-20 21:46:32 -04:00
|
|
|
ctx := newContext(r, w, "ListObjectsV2")
|
2023-04-06 10:52:35 -04:00
|
|
|
api.listObjectsV2Handler(ctx, w, r, false)
|
|
|
|
}
|
2018-03-14 15:01:47 -04:00
|
|
|
|
2023-04-06 10:52:35 -04: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 16:21:51 -05:00
|
|
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
2018-10-12 15:25:59 -04:00
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
2016-08-10 21:47:49 -04:00
|
|
|
objectAPI := api.ObjectAPI()
|
|
|
|
if objectAPI == nil {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
2016-08-10 21:47:49 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.ListBucketAction, bucket, ""); s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 15:32:05 -04:00
|
|
|
return
|
|
|
|
}
|
2016-11-21 16:51:05 -05:00
|
|
|
|
2023-04-06 10:52:35 -04:00
|
|
|
var checkObjMeta metaCheckFn
|
|
|
|
if metadata {
|
|
|
|
checkObjMeta = func(name string, action policy.Action) (s3Err APIErrorCode) {
|
|
|
|
return checkRequestAuthType(ctx, r, action, bucket, name)
|
|
|
|
}
|
|
|
|
}
|
2021-08-08 01:43:01 -04:00
|
|
|
urlValues := r.Form
|
2018-06-25 15:35:43 -04:00
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
// Extract all the listObjectsV2 query params to their native values.
|
2019-02-24 01:14:24 -05:00
|
|
|
prefix, token, startAfter, delimiter, fetchOwner, maxKeys, encodingType, errCode := getListObjectsV2Args(urlValues)
|
2018-06-25 15:35:43 -04:00
|
|
|
if errCode != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(errCode), r.URL)
|
2018-06-25 15:35:43 -04:00
|
|
|
return
|
|
|
|
}
|
2016-07-17 15:32:05 -04:00
|
|
|
|
2016-09-10 13:44:38 -04:00
|
|
|
// Validate the query params before beginning to serve the request.
|
2022-11-08 16:29:05 -05:00
|
|
|
if s3Error := validateListObjectsArgs(prefix, token, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 15:32:05 -04:00
|
|
|
return
|
|
|
|
}
|
2019-02-12 04:25:52 -05:00
|
|
|
|
2021-06-10 11:17:03 -04:00
|
|
|
var (
|
|
|
|
listObjectsV2Info ListObjectsV2Info
|
|
|
|
err error
|
|
|
|
)
|
|
|
|
|
|
|
|
if r.Header.Get(xMinIOExtract) == "true" && strings.Contains(prefix, archivePattern) {
|
2024-01-18 02:03:17 -05:00
|
|
|
// Initiate a list objects operation inside a zip file based in the input params
|
2021-06-10 11:17:03 -04:00
|
|
|
listObjectsV2Info, err = listObjectsV2InArchive(ctx, objectAPI, bucket, prefix, token, delimiter, maxKeys, fetchOwner, startAfter)
|
|
|
|
} else {
|
2024-01-18 02:03:17 -05:00
|
|
|
// Initiate a list objects operation based on the input params.
|
2021-06-10 11:17:03 -04:00
|
|
|
// 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 15:32:05 -04:00
|
|
|
if err != nil {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
2016-07-17 15:32:05 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-04-04 14:42:03 -04:00
|
|
|
if err = DecryptETags(ctx, GlobalKMS, listObjectsV2Info.Objects); err != nil {
|
2022-03-25 18:01:41 -04:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
2018-03-01 14:37:57 -05:00
|
|
|
|
2020-10-28 12:18:35 -04:00
|
|
|
response := generateListObjectsV2Response(bucket, prefix, token, listObjectsV2Info.NextContinuationToken, startAfter,
|
2019-11-21 04:54:49 -05:00
|
|
|
delimiter, encodingType, fetchOwner, listObjectsV2Info.IsTruncated,
|
2023-04-06 10:52:35 -04:00
|
|
|
maxKeys, listObjectsV2Info.Objects, listObjectsV2Info.Prefixes, checkObjMeta)
|
2017-01-06 03:37:00 -05:00
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
// Write success response.
|
2023-01-16 18:38:33 -05:00
|
|
|
writeSuccessResponseXML(w, encodeResponseList(response))
|
2016-07-17 15:32:05 -04:00
|
|
|
}
|
|
|
|
|
2020-07-03 22:27:13 -04:00
|
|
|
func parseRequestToken(token string) (subToken string, nodeIndex int) {
|
|
|
|
if token == "" {
|
|
|
|
return token, -1
|
|
|
|
}
|
2023-08-11 16:12:35 -04:00
|
|
|
i := strings.Index(token, ":")
|
2020-07-03 14:53:03 -04:00
|
|
|
if i < 0 {
|
2020-07-03 22:27:13 -04:00
|
|
|
return token, -1
|
2020-07-03 14:53:03 -04:00
|
|
|
}
|
|
|
|
nodeIndex, err := strconv.Atoi(token[i+1:])
|
|
|
|
if err != nil {
|
2020-07-03 22:27:13 -04:00
|
|
|
return token, -1
|
2020-07-02 13:56:22 -04:00
|
|
|
}
|
2020-07-03 14:53:03 -04:00
|
|
|
subToken = token[:i]
|
2020-07-03 22:27:13 -04: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 14:53:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func proxyRequestByNodeIndex(ctx context.Context, w http.ResponseWriter, r *http.Request, index int) (success bool) {
|
|
|
|
if len(globalProxyEndpoints) == 0 {
|
2020-07-02 13:56:22 -04:00
|
|
|
return false
|
|
|
|
}
|
2020-07-03 14:53:03 -04:00
|
|
|
if index < 0 || index >= len(globalProxyEndpoints) {
|
2020-07-02 13:56:22 -04:00
|
|
|
return false
|
|
|
|
}
|
2020-07-03 14:53:03 -04:00
|
|
|
ep := globalProxyEndpoints[index]
|
|
|
|
if ep.IsLocal {
|
|
|
|
return false
|
2020-07-02 13:56:22 -04:00
|
|
|
}
|
2020-07-03 14:53:03 -04:00
|
|
|
return proxyRequest(ctx, w, r, ep)
|
|
|
|
}
|
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
// ListObjectsV1Handler - GET Bucket (List Objects) Version 1.
|
|
|
|
// --------------------------
|
2021-08-31 20:18:13 -04:00
|
|
|
// This implementation of the GET operation returns some or all (up to 1000)
|
2016-07-17 15:32:05 -04: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 21:46:32 -04:00
|
|
|
ctx := newContext(r, w, "ListObjectsV1")
|
2018-03-14 15:01:47 -04:00
|
|
|
|
2021-01-26 16:21:51 -05:00
|
|
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
2018-10-12 15:25:59 -04:00
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
2016-08-10 21:47:49 -04:00
|
|
|
objectAPI := api.ObjectAPI()
|
|
|
|
if objectAPI == nil {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
2016-08-10 21:47:49 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.ListBucketAction, bucket, ""); s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 15:32:05 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extract all the litsObjectsV1 query params to their native values.
|
2021-08-08 01:43:01 -04:00
|
|
|
prefix, marker, delimiter, maxKeys, encodingType, s3Error := getListObjectsV1Args(r.Form)
|
2018-10-18 10:31:46 -04:00
|
|
|
if s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2018-10-18 10:31:46 -04:00
|
|
|
return
|
|
|
|
}
|
2016-07-17 15:32:05 -04:00
|
|
|
|
2019-02-12 04:25:52 -05:00
|
|
|
// Validate all the query params before beginning to serve the request.
|
2022-11-08 16:29:05 -05:00
|
|
|
if s3Error := validateListObjectsArgs(prefix, marker, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
2016-07-17 15:32:05 -04:00
|
|
|
return
|
|
|
|
}
|
2019-02-12 04:25:52 -05:00
|
|
|
|
2018-03-28 17:14:06 -04:00
|
|
|
listObjects := objectAPI.ListObjects
|
2019-02-12 04:25:52 -05:00
|
|
|
|
2024-01-18 02:03:17 -05:00
|
|
|
// Initiate a list objects operation based on the input params.
|
2016-07-17 15:32:05 -04:00
|
|
|
// On success would return back ListObjectsInfo object to be
|
2018-06-28 19:02:02 -04:00
|
|
|
// marshaled into S3 compatible XML header.
|
2018-03-28 17:14:06 -04:00
|
|
|
listObjectsInfo, err := listObjects(ctx, bucket, prefix, marker, delimiter, maxKeys)
|
2016-07-17 15:32:05 -04:00
|
|
|
if err != nil {
|
2021-06-17 23:27:04 -04:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
2016-07-17 15:32:05 -04:00
|
|
|
return
|
|
|
|
}
|
2018-03-01 14:37:57 -05:00
|
|
|
|
2022-04-04 14:42:03 -04:00
|
|
|
if err = DecryptETags(ctx, GlobalKMS, listObjectsInfo.Objects); err != nil {
|
2022-03-25 18:01:41 -04:00
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
2020-05-24 14:19:17 -04:00
|
|
|
|
2019-02-24 01:14:24 -05:00
|
|
|
response := generateListObjectsV1Response(bucket, prefix, marker, delimiter, encodingType, maxKeys, listObjectsInfo)
|
2017-01-06 03:37:00 -05:00
|
|
|
|
2016-07-17 15:32:05 -04:00
|
|
|
// Write success response.
|
2023-01-16 18:38:33 -05:00
|
|
|
writeSuccessResponseXML(w, encodeResponseList(response))
|
2016-07-17 15:32:05 -04:00
|
|
|
}
|