@@ -1409,7 +1409,7 @@ HTTPException S3FileSystem::GetHTTPError(FileHandle &handle, const HTTPResponse
14091409}
14101410
14111411string AWSListObjectV2::Request (const string &path, HTTPParams &http_params, S3AuthParams &s3_auth_params,
1412- string &continuation_token, optional_idx max_keys) {
1412+ string &continuation_token, bool use_delimiter, optional_idx max_keys) {
14131413 const idx_t MAX_RETRIES = 1 ;
14141414 for (idx_t it = 0 ; it <= MAX_RETRIES; it++) {
14151415 auto parsed_url = S3FileSystem::S3UrlParse (path, s3_auth_params);
@@ -1418,15 +1418,21 @@ string AWSListObjectV2::Request(const string &path, HTTPParams &http_params, S3A
14181418 string req_path = parsed_url.path .substr (0 , parsed_url.path .length () - parsed_url.key .length ());
14191419
14201420 string req_params;
1421+ // NOTE: req_params needs to be sorted
14211422 if (!continuation_token.empty ()) {
14221423 req_params += " continuation-token=" + S3FileSystem::UrlEncode (continuation_token, true );
14231424 req_params += " &" ;
14241425 }
1426+
1427+ if (use_delimiter) {
1428+ req_params += " delimiter=%2F&" ;
1429+ }
1430+
14251431 req_params += " encoding-type=url&list-type=2" ;
1426- req_params += " &prefix=" + S3FileSystem::UrlEncode (parsed_url.key , true );
14271432 if (max_keys.IsValid ()) {
14281433 req_params += " &max-keys=" + to_string (max_keys.GetIndex ());
14291434 }
1435+ req_params += " &prefix=" + S3FileSystem::UrlEncode (parsed_url.key , true );
14301436
14311437 auto header_map =
14321438 CreateS3Header (req_path, req_params, parsed_url.host , " s3" , " GET" , s3_auth_params, " " , " " , " " , " " );
0 commit comments