Skip to content

Commit

Permalink
return offset-aware modification time (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 authored Dec 1, 2023
1 parent b31985d commit 94ef88e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion s3fs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ def modified(self, path, version_id=None, refresh=False):
if "LastModified" not in info:
# This path is a bucket or folder, which do not currently have a modified date
raise IsADirectoryError
return info["LastModified"].replace(tzinfo=None)
return info["LastModified"]

def sign(self, path, expiration=100, **kwargs):
return self.url(path, expires=expiration, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions s3fs/tests/test_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,7 @@ def test_modified(s3):
s3.touch(file_path)
modified = s3.modified(path=file_path)
assert isinstance(modified, datetime.datetime)
assert modified.tzinfo is not None

# Test directory
with pytest.raises(IsADirectoryError):
Expand Down

0 comments on commit 94ef88e

Please sign in to comment.