Skip to content

Commit

Permalink
Skip nested directories when using S3DirectoryLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
Falydoor committed Feb 20, 2024
1 parent 223e5ef commit 342e3a4
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def load(self) -> List[Document]:
bucket = s3.Bucket(self.bucket)
docs = []
for obj in bucket.objects.filter(Prefix=self.prefix):
# Skip directories
if obj.size == 0 and obj.key.endswith('/'):
continue
loader = S3FileLoader(
self.bucket,
obj.key,
Expand Down

0 comments on commit 342e3a4

Please sign in to comment.