diff --git a/pulp_container/app/registry_api.py b/pulp_container/app/registry_api.py index f60d75b80..2f1e6069d 100644 --- a/pulp_container/app/registry_api.py +++ b/pulp_container/app/registry_api.py @@ -10,6 +10,7 @@ import logging import hashlib import re +import tarfile from aiohttp.client_exceptions import ClientResponseError from itertools import chain @@ -929,14 +930,23 @@ def put(self, request, path, pk=None): artifact.touch() blob = None - try: + if tarfile.is_tarfile(artifact.file): + blob = self.create_blob(artifact, digest) + repository.pending_blobs.add(blob) + else: raw_manifest = artifact.file.read().decode("utf-8") manifest = json.loads(raw_manifest) blob = self.create_config_blob(manifest, raw_manifest, digest) repository.pending_config_blobs.add(blob) - except UnicodeDecodeError: - blob = self.create_blob(artifact, digest) - repository.pending_blobs.add(blob) + + #try: + # raw_manifest = artifact.file.read().decode("utf-8") + # manifest = json.loads(raw_manifest) + # blob = self.create_config_blob(manifest, raw_manifest, digest) + # repository.pending_config_blobs.add(blob) + #except UnicodeDecodeError: + # blob = self.create_blob(artifact, digest) + # repository.pending_blobs.add(blob) upload.delete() return BlobResponse(blob, path, 201, request)