@@ -718,10 +718,13 @@ def touch(self, path, truncate=True, data=None, **kwargs):
718718 if not truncate and self .exists (path ):
719719 raise ValueError ("S3 does not support touching existent files" )
720720 try :
721- self .call_s3 (self .s3 .put_object , kwargs , Bucket = bucket , Key = key )
721+ write_result = self .call_s3 (
722+ self .s3 .put_object , kwargs , Bucket = bucket , Key = key
723+ )
722724 except ClientError as ex :
723725 raise translate_boto_error (ex ) from ex
724726 self .invalidate_cache (self ._parent (path ))
727+ return write_result
725728
726729 async def _cat_file (self , path , version_id = None , start = None , end = None ):
727730 bucket , key , vers = self .split_path (path )
@@ -1707,7 +1710,7 @@ def commit(self):
17071710 if self .buffer is not None :
17081711 logger .debug ("Empty file committed %s" % self )
17091712 self ._abort_mpu ()
1710- self .fs .touch (self .path )
1713+ write_result = self .fs .touch (self .path )
17111714 elif not self .parts :
17121715 if self .buffer is not None :
17131716 logger .debug ("One-shot upload of %s" % self )
@@ -1720,8 +1723,6 @@ def commit(self):
17201723 Body = data ,
17211724 ** self .kwargs ,
17221725 )
1723- if self .fs .version_aware :
1724- self .version_id = write_result .get ("VersionId" )
17251726 else :
17261727 raise RuntimeError
17271728 else :
@@ -1734,9 +1735,9 @@ def commit(self):
17341735 UploadId = self .mpu ["UploadId" ],
17351736 MultipartUpload = part_info ,
17361737 )
1737- if self .fs .version_aware :
1738- self .version_id = write_result .get ("VersionId" )
17391738
1739+ if self .fs .version_aware :
1740+ self .version_id = write_result .get ("VersionId" )
17401741 # complex cache invalidation, since file's appearance can cause several
17411742 # directories
17421743 self .buffer = None
0 commit comments