in alibabacloud_oss_v2/filelike.py [0:0]
def _check_object_same(src_modtime, src_etag, offset: int, result: models.GetObjectResult):
modtime = result.last_modified
etag = result.etag
got_offset = 0
if (crange := result.headers.get("Content-Range", None)):
content_range = utils.parse_content_range(crange)
got_offset = content_range[0]
if got_offset != offset:
return ValueError(f"Range get fail, expect offset:{offset}, got offset:{got_offset}")
if ((modtime and src_modtime and modtime != src_modtime) or
(etag and src_etag and etag != src_etag)):
return ValueError(f"Source file is changed, origin info[{src_modtime},{src_etag}], new info [{modtime},{etag}]")
return None