From bedc782abd0526823aa978d18a4f8c25dc71c002 Mon Sep 17 00:00:00 2001 From: Victor Ananyev Date: Tue, 28 May 2019 12:46:57 +0300 Subject: [PATCH] Bug: Scandir doesn't work if the directory doesn't exist --- fs_s3fs/_s3fs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs_s3fs/_s3fs.py b/fs_s3fs/_s3fs.py index 83b6fb2..0ecd462 100644 --- a/fs_s3fs/_s3fs.py +++ b/fs_s3fs/_s3fs.py @@ -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(