Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Scandir doesn't work if the directory doesn't exist #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions fs_s3fs/_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,10 @@ def scandir(self, path, namespaces=None, page=None):
_s3_key = self._path_to_dir_key(_path)
prefix_len = len(_s3_key)

info = self.getinfo(path)
if not info.is_dir:
raise errors.DirectoryExpected(path)
if self.strict:
info = self.getinfo(path)
if not info.is_dir:
raise errors.DirectoryExpected(path)

paginator = self.client.get_paginator("list_objects")
_paginate = paginator.paginate(
Expand Down