aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Neporada <neporada@gmail.com>2022-07-06 01:28:19 +0300
committerAndrey Neporada <neporada@gmail.com>2022-07-06 01:28:19 +0300
commitab335cdfc65f7e7e465775b4516c9c9582d988ef (patch)
treed452a5f5b58f708484d207a403b7674b1758a7fd
parent41223d67bc008890be4c26f2860a749faad77d15 (diff)
downloadydb-ab335cdfc65f7e7e465775b4516c9c9582d988ef.tar.gz
[YQ-1198] Exclude directories from S3 listing
ref:5dae42b7b9670f2110f5be06f9bbb96c8dd45caf
-rw-r--r--ydb/library/yql/providers/s3/provider/yql_s3_io_discovery.cpp3
-rw-r--r--ydb/library/yql/providers/s3/provider/yql_s3_list.cpp4
2 files changed, 6 insertions, 1 deletions
diff --git a/ydb/library/yql/providers/s3/provider/yql_s3_io_discovery.cpp b/ydb/library/yql/providers/s3/provider/yql_s3_io_discovery.cpp
index 528fec319a..306cd0c5f6 100644
--- a/ydb/library/yql/providers/s3/provider/yql_s3_io_discovery.cpp
+++ b/ydb/library/yql/providers/s3/provider/yql_s3_io_discovery.cpp
@@ -134,7 +134,8 @@ public:
if (IS3Lister::HasWildcards(req.Pattern)) {
ctx.AddError(TIssue(ctx.GetPosition(object.Pos()), TStringBuilder() << "Object " << req.Pattern << " has no items."));
} else {
- ctx.AddError(TIssue(ctx.GetPosition(object.Pos()), TStringBuilder() << "Object " << req.Pattern << " doesn't exist."));
+ ctx.AddError(TIssue(ctx.GetPosition(object.Pos()),
+ TStringBuilder() << "Object " << req.Pattern << " doesn't exist" << (req.Pattern.EndsWith('/') ? " or is a directory." : ".")));
}
return TStatus::Error;
}
diff --git a/ydb/library/yql/providers/s3/provider/yql_s3_list.cpp b/ydb/library/yql/providers/s3/provider/yql_s3_list.cpp
index 780e0b964d..5b6af20c7b 100644
--- a/ydb/library/yql/providers/s3/provider/yql_s3_list.cpp
+++ b/ydb/library/yql/providers/s3/provider/yql_s3_list.cpp
@@ -166,6 +166,10 @@ private:
for (const auto& content : contents) {
TString path = content.Node("s3:Key", false, nss).Value<TString>();
+ if (path.EndsWith('/')) {
+ // skip 'directories'
+ continue;
+ }
TVector<TString> matchedGlobs;
if (filter(path, matchedGlobs)) {
output->emplace_back();