Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-deposit
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Platform
Development
Debian Packaging
swh-deposit
Commits
7855358d
Commit
7855358d
authored
1 year ago
by
Jenkins for Software Heritage
Browse files
Options
Downloads
Plain Diff
New upstream version 1.4.4
parents
cdeccf97
0a10ac37
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
PKG-INFO
+1
-1
1 addition, 1 deletion
PKG-INFO
mypy.ini
+6
-0
6 additions, 0 deletions
mypy.ini
swh.deposit.egg-info/PKG-INFO
+1
-1
1 addition, 1 deletion
swh.deposit.egg-info/PKG-INFO
swh/deposit/api/private/deposit_check.py
+37
-0
37 additions, 0 deletions
swh/deposit/api/private/deposit_check.py
with
45 additions
and
2 deletions
PKG-INFO
+
1
−
1
View file @
7855358d
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
...
...
This diff is collapsed.
Click to expand it.
mypy.ini
+
6
−
0
View file @
7855358d
...
...
@@ -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
This diff is collapsed.
Click to expand it.
swh.deposit.egg-info/PKG-INFO
+
1
−
1
View file @
7855358d
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
...
...
This diff is collapsed.
Click to expand it.
swh/deposit/api/private/deposit_check.py
+
37
−
0
View file @
7855358d
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment