Skip to content

Commit

Permalink
Fixed Content-Length key error during image upload.
Browse files Browse the repository at this point in the history
closes #921
  • Loading branch information
ipanova committed Jul 29, 2022
1 parent b4f2004 commit e7b75cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/921.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the Content-Length key error raised when uploading images.
4 changes: 3 additions & 1 deletion pulp_container/app/registry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def partial_update(self, request, path, pk=None):
length = end - start + 1

else:
length = int(request.headers["Content-Length"])
length = int(request.headers.get("Content-Length", 0))
start = 0

with transaction.atomic():
Expand Down Expand Up @@ -662,6 +662,8 @@ def partial_update(self, request, path, pk=None):
artifact = Artifact.objects.get(sha256=artifact.sha256)
artifact.touch()
upload.artifact = artifact
if not length:
length = artifact.size

upload.size += length
upload.save()
Expand Down

0 comments on commit e7b75cf

Please sign in to comment.