File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1343,6 +1343,7 @@ def iterdir(
1343
1343
path : FilePath | ReadCsvBuffer [bytes ] | ReadCsvBuffer [str ],
1344
1344
extensions : str | Iterable [str ] | None = None ,
1345
1345
glob : str | None = None ,
1346
+ storage_options : StorageOptions | None = None ,
1346
1347
) -> list [FilePath ] | ReadCsvBuffer [bytes ] | ReadCsvBuffer [str ]:
1347
1348
"""Yield file paths in a directory (no nesting allowed).
1348
1349
@@ -1430,7 +1431,15 @@ def iterdir(
1430
1431
1431
1432
# Remote paths
1432
1433
fsspec = import_optional_dependency ("fsspec" , extra = scheme )
1433
- fs , inner_path = fsspec .core .url_to_fs (path_str )
1434
+
1435
+ # GH #11071
1436
+ # Two legacy S3 protocols (s3n and s3a) are replaced with s3
1437
+ if path_str .startswith ("s3n://" ):
1438
+ path_str = path_str .replace ("s3n://" , "s3://" )
1439
+ if path_str .startswith ("s3a://" ):
1440
+ path_str = path_str .replace ("s3a://" , "s3://" )
1441
+
1442
+ fs , inner_path = fsspec .core .url_to_fs (path_str , ** storage_options )
1434
1443
if fs .isfile (inner_path ):
1435
1444
path_obj = PurePosixPath (inner_path )
1436
1445
if _match_file (
Original file line number Diff line number Diff line change @@ -727,7 +727,8 @@ def _read(
727
727
728
728
extensions = kwds .get ("extensions" , None )
729
729
glob = kwds .get ("glob" , None )
730
- files = iterdir (filepath_or_buffer , extensions , glob )
730
+ storage_options = kwds .get ("storage_options" , None )
731
+ files = iterdir (filepath_or_buffer , extensions , glob , storage_options )
731
732
732
733
if isinstance (files , list ) and not files :
733
734
raise FileNotFoundError (
You can’t perform that action at this time.
0 commit comments