Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions simple_repository_browser/fetch_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,6 @@ async def _fetch_metadata_resource(
if isinstance(resource, model.TextResource):
with open(tmp_file_path, "wb") as tmp:
tmp.write(resource.text.encode())
if not file.upload_time:
# If the repository doesn't provide information about the upload time, estimate
# it from the headers of the resource, if they exist.
if ct := resource.context.get("creation-date"):
if isinstance(ct, str):
file = dataclasses.replace(
file, upload_time=datetime.datetime.fromisoformat(ct)
)
elif isinstance(resource, model.HttpResource):
await fetch_file(resource.url, tmp_file_path)
else:
Expand Down
11 changes: 7 additions & 4 deletions simple_repository_browser/short_release_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dataclasses
from datetime import datetime
from datetime import datetime, timezone
import functools
import types
import typing
Expand Down Expand Up @@ -135,9 +135,12 @@ def release_infos(
quarantined_file: Quarantinefile = {
"filename": file_info["filename"],
"quarantine_release_time": datetime.strptime(
file_info["quarantine_release_time"], date_format
),
"upload_time": datetime.strptime(file_info["upload_time"], date_format),
file_info["quarantine_release_time"],
date_format,
).replace(tzinfo=timezone.utc),
"upload_time": datetime.strptime(
file_info["upload_time"], date_format
).replace(tzinfo=timezone.utc),
}
version_str = None
try:
Expand Down