@@ -721,11 +721,10 @@ def touch(self, path, truncate=True, data=None, **kwargs):
721721 write_result = self .call_s3 (
722722 self .s3 .put_object , kwargs , Bucket = bucket , Key = key
723723 )
724- if self .version_aware :
725- self .version_id = write_result .get ("VersionId" )
726724 except ClientError as ex :
727725 raise translate_boto_error (ex ) from ex
728726 self .invalidate_cache (self ._parent (path ))
727+ return write_result
729728
730729 async def _cat_file (self , path , version_id = None , start = None , end = None ):
731730 bucket , key , vers = self .split_path (path )
@@ -1711,10 +1710,7 @@ def commit(self):
17111710 if self .buffer is not None :
17121711 logger .debug ("Empty file committed %s" % self )
17131712 self ._abort_mpu ()
1714- self .fs .touch (self .path )
1715- if self .fs .version_aware and self .fs .version_id :
1716- self .version_id = self .fs .version_id
1717-
1713+ write_result = self .fs .touch (self .path )
17181714 elif not self .parts :
17191715 if self .buffer is not None :
17201716 logger .debug ("One-shot upload of %s" % self )
@@ -1727,8 +1723,6 @@ def commit(self):
17271723 Body = data ,
17281724 ** self .kwargs ,
17291725 )
1730- if self .fs .version_aware :
1731- self .version_id = write_result .get ("VersionId" )
17321726 else :
17331727 raise RuntimeError
17341728 else :
@@ -1741,9 +1735,9 @@ def commit(self):
17411735 UploadId = self .mpu ["UploadId" ],
17421736 MultipartUpload = part_info ,
17431737 )
1744- if self .fs .version_aware :
1745- self .version_id = write_result .get ("VersionId" )
17461738
1739+ if self .fs .version_aware :
1740+ self .version_id = write_result .get ("VersionId" )
17471741 # complex cache invalidation, since file's appearance can cause several
17481742 # directories
17491743 self .buffer = None
0 commit comments