Skip to content
Snippets Groups Projects
Commit 7f745d9a authored by Jenkins for Software Heritage's avatar Jenkins for Software Heritage
Browse files

Merge tag 'debian/1.4.4-1_swh1' into debian/buster-swh

parents f66b1ba1 b1e50d6d
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 2.1
Name: swh.deposit
Version: 1.4.3
Version: 1.4.4
Summary: Software Heritage Deposit Server
Home-page: https://forge.softwareheritage.org/source/swh-deposit/
Author: Software Heritage developers
......
swh-deposit (1.4.3-1~swh1~bpo10+1) buster-swh; urgency=medium
swh-deposit (1.4.4-1~swh1) unstable-swh; urgency=medium
* Rebuild for buster-swh
* New upstream release 1.4.4 - (tagged by Antoine R. Dumont
(@ardumont) <ardumont@softwareheritage.org> on 2023-11-24 12:40:08
+0100)
* Upstream changes: - v1.4.4 - azure blobstorage: Reset blob's
content-encoding to allow check
-- Software Heritage autobuilder (on jenkins-debian1) <jenkins@jenkins-debian1.internal.softwareheritage.org> Fri, 24 Nov 2023 09:03:34 +0000
-- Software Heritage autobuilder (on jenkins-debian1) <jenkins@jenkins-debian1.internal.softwareheritage.org> Fri, 24 Nov 2023 11:46:38 +0000
swh-deposit (1.4.3-1~swh1) unstable-swh; urgency=medium
......
......@@ -44,3 +44,9 @@ ignore_missing_imports = True
[mypy-swh.storage.*]
ignore_missing_imports = True
[mypy-storages.*]
ignore_missing_imports = True
[mypy-azure.*]
ignore_missing_imports = True
Metadata-Version: 2.1
Name: swh.deposit
Version: 1.4.3
Version: 1.4.4
Summary: Software Heritage Deposit Server
Home-page: https://forge.softwareheritage.org/source/swh-deposit/
Author: Software Heritage developers
......
......@@ -125,6 +125,11 @@ class APIChecks(APIPrivateView, APIGet, DepositReadMixin):
# Use python's File api which is consistent across different types of
# storage backends (e.g. file, azure, ...)
# I did not find any other) workaround for azure blobstorage use, noop
# otherwise
reset_content_settings_if_needed(archive)
# FIXME: ^ Implement a better way (after digging into django-storages[azure]
with archive.open("rb") as archive_fp:
try:
with zipfile.ZipFile(archive_fp) as zip_fp:
......@@ -214,3 +219,35 @@ class APIChecks(APIPrivateView, APIGet, DepositReadMixin):
deposit.save()
return status.HTTP_200_OK, response, "application/json"
def reset_content_settings_if_needed(archive) -> None:
"""This resets the content_settings on the associated blob stored in an azure
blobstorage. This prevents the correct reading of the file and failing the checks
for no good reason.
"""
try:
from storages.backends.azure_storage import AzureStorage
except ImportError:
return None
if not isinstance(archive.storage, AzureStorage):
return None
from azure.storage.blob import ContentSettings
blob_client = archive.storage.client.get_blob_client(archive.name)
# Get the existing blob properties
properties = blob_client.get_blob_properties()
# reset content encoding in the settings
content_settings = dict(properties.content_settings)
content_settings["content_encoding"] = ""
# Set the content_type and content_language headers, and populate the remaining
# headers from the existing properties
blob_headers = ContentSettings(**content_settings)
blob_client.set_http_headers(blob_headers)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment