Skip to content

Commit

Permalink
ensuring that S3ObjectVersion is correct by construction
Browse files Browse the repository at this point in the history
  • Loading branch information
why-not-try-calmer committed Aug 17, 2023
1 parent fe8338a commit c16353f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions docker-app/qfieldcloud/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ def size(self) -> int:

@property
def e_tag(self) -> str:
return self._data.e_tag
if self._data.e_tag is None:
return ""
else:
return self._data.e_tag.replace('"', "")

@property
def md5sum(self) -> str:
return self._data.e_tag.replace('"', "")
return self.e_tag

@property
def is_latest(self) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions docker-app/qfieldcloud/core/views/files_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get(self, request: Request, projectid: str) -> Response:

version_data = {
"size": version.size,
"md5sum": version.e_tag.replace('"', ""),
"md5sum": version.e_tag,
"version_id": version.version_id,
"last_modified": last_modified,
"is_latest": version.is_latest,
Expand Down Expand Up @@ -119,7 +119,7 @@ def get(self, request: Request, projectid: str) -> Response:

files[version.key]["name"] = filename
files[version.key]["size"] = version.size
files[version.key]["md5sum"] = version.e_tag.replace('"', "")
files[version.key]["md5sum"] = version_data["md5sum"]
files[version.key]["last_modified"] = last_modified
files[version.key]["is_attachment"] = is_attachment

Expand Down

0 comments on commit c16353f

Please sign in to comment.