@@ -996,6 +996,7 @@ std::vector<directory_entry> S3::ls_with_sizes(
996996
997997 const auto prefix_dir = prefix.add_trailing_slash ();
998998
999+ auto protocol = prefix.backend_name () + " ://" ;
9991000 auto prefix_str = prefix_dir.to_string ();
10001001 Aws::Http::URI aws_uri = prefix_str.c_str ();
10011002 std::string aws_auth (aws_uri.GetAuthority ());
@@ -1029,7 +1030,7 @@ std::vector<directory_entry> S3::ls_with_sizes(
10291030 std::string file (object.GetKey ());
10301031 uint64_t size = object.GetSize ();
10311032 entries.emplace_back (
1032- " s3:// " + aws_auth + add_front_slash (file), size, false );
1033+ protocol + aws_auth + add_front_slash (file), size, false );
10331034 }
10341035
10351036 for (const auto & object :
@@ -1038,7 +1039,7 @@ std::vector<directory_entry> S3::ls_with_sizes(
10381039 // For "directories" it doesn't seem possible to get a shallow size in
10391040 // S3, so the size of such an entry will be 0 in S3.
10401041 entries.emplace_back (
1041- " s3:// " + aws_auth + add_front_slash (remove_trailing_slash (file)),
1042+ protocol + aws_auth + add_front_slash (remove_trailing_slash (file)),
10421043 0 ,
10431044 true );
10441045 }
@@ -1094,7 +1095,7 @@ uint64_t S3::file_size(const URI& uri) const {
10941095 }
10951096 throw S3Exception (
10961097 std::string (
1097- " Cannot retrieve S3 object size; Error while listing file s3:// " ) +
1098+ " Cannot retrieve S3 object size; Error while listing file " ) +
10981099 uri.to_string () + outcome_error_message (head_object_outcome) +
10991100 additional_context);
11001101 }
@@ -2044,7 +2045,8 @@ S3Scanner::S3Scanner(
20442045 bool recursive,
20452046 int max_keys)
20462047 : LsScanner(prefix, std::move(result_filter), recursive)
2047- , client_(client) {
2048+ , client_(client)
2049+ , protocol_(prefix.backend_name() + ":// ") {
20482050 const auto prefix_dir = prefix.add_trailing_slash();
20492051 auto prefix_str = prefix_dir.to_string();
20502052 Aws::Http::URI aws_uri = prefix_str.c_str();
@@ -2071,7 +2073,8 @@ S3Scanner::S3Scanner(
20712073 bool recursive,
20722074 int max_keys)
20732075 : LsScanner(prefix, std::move(result_filter), recursive)
2074- , client_(client) {
2076+ , client_(client)
2077+ , protocol_(prefix.backend_name() + ":// ") {
20752078 const auto prefix_dir = prefix.add_trailing_slash();
20762079 auto prefix_str = prefix_dir.to_string();
20772080 Aws::Http::URI aws_uri = prefix_str.c_str();
@@ -2173,11 +2176,12 @@ void S3Scanner::next(typename Iterator::pointer& ptr) {
21732176 ptr = fetch_results ();
21742177 }
21752178
2176- std::string bucket = " s3://" + std::string (list_objects_request_.GetBucket ());
2179+ std::string bucket =
2180+ protocol_ + std::string (list_objects_request_.GetBucket ());
21772181 while (ptr != end_) {
21782182 auto object = *ptr;
21792183 uint64_t size = object.GetSize ();
2180- // The object key does not contain s3:// prefix or the bucket name.
2184+ // The object key does not contain protocol prefix or the bucket name.
21812185 std::string path =
21822186 bucket + S3::add_front_slash (std::string (object.GetKey ()));
21832187
0 commit comments