Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #477 -- Don't set IfMatch if ETag is missing #557

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions s3fs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ def __init__(
self.append_block = True
self.loc = loc

if "r" in mode:
if "r" in mode and "ETag" in self.details:
self.req_kw["IfMatch"] = self.details["ETag"]

def _call_s3(self, method, *kwarglist, **kwargs):
Expand Down Expand Up @@ -1883,7 +1883,7 @@ def setxattr(self, copy_kwargs=None, **kwargs):
"""
if self.writable():
raise NotImplementedError(
"cannot update metadata while file " "is open for writing"
"cannot update metadata while file is open for writing"
)
return self.fs.setxattr(self.path, copy_kwargs=copy_kwargs, **kwargs)

Expand All @@ -1906,7 +1906,7 @@ def _fetch_range(self, start, end):
except OSError as ex:
if ex.args[0] == errno.EINVAL and "pre-conditions" in ex.args[1]:
raise FileExpired(
filename=self.details["name"], e_tag=self.details["ETag"]
filename=self.details["name"], e_tag=self.details.get("ETag")
) from ex
else:
raise
Expand Down