@@ -452,9 +452,9 @@ def info(self, path, version_id=None):
452
452
raise ValueError ("version_id cannot be specified if the "
453
453
"filesystem is not version aware" )
454
454
kwargs ['VersionId' ] = version_id
455
- if self .version_aware :
455
+ bucket , key = self .split_path (path )
456
+ if self .version_aware or (key and self ._ls_from_cache (path ) is None ):
456
457
try :
457
- bucket , key = self .split_path (path )
458
458
out = self ._call_s3 (self .s3 .head_object , kwargs , Bucket = bucket ,
459
459
Key = key , ** self .req_kw )
460
460
return {
@@ -463,7 +463,7 @@ def info(self, path, version_id=None):
463
463
'LastModified' : out ['LastModified' ],
464
464
'Size' : out ['ContentLength' ],
465
465
'size' : out ['ContentLength' ],
466
- 'path ' : '/' .join ([bucket , key ]),
466
+ 'name ' : '/' .join ([bucket , key ]),
467
467
'type' : 'file' ,
468
468
'StorageClass' : "STANDARD" ,
469
469
'VersionId' : out .get ('VersionId' )
@@ -472,7 +472,7 @@ def info(self, path, version_id=None):
472
472
ee = translate_boto_error (e )
473
473
# This could have failed since the thing we are looking for is a prefix.
474
474
if isinstance (ee , FileNotFoundError ):
475
- return super ().info (path )
475
+ return super (S3FileSystem , self ).info (path )
476
476
else :
477
477
raise ee
478
478
except ParamValidationError as e :
@@ -913,7 +913,9 @@ def invalidate_cache(self, path=None):
913
913
else :
914
914
path = self ._strip_protocol (path )
915
915
self .dircache .pop (path , None )
916
- self .dircache .pop (self ._parent (path ), None )
916
+ while path :
917
+ self .dircache .pop (path , None )
918
+ path = self ._parent (path )
917
919
918
920
def walk (self , path , maxdepth = None , ** kwargs ):
919
921
if path in ['' , '*' ] + [f'{ p } ://' for p in self .protocol ]:
0 commit comments