Skip to content

Commit

Permalink
Have the content app handle UnsupportedDigestValidationError
Browse files Browse the repository at this point in the history
In https://pulp.plan.io/issues/8435 we added a check to downloader to
prevent the download of files without allowed checksums. This code
updates the downloader to handle the exception that gets raised.

fixes #7989
  • Loading branch information
David Davis authored and daviddavis committed Mar 26, 2021
1 parent b10ac5e commit 8a77316
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/7989.feature
@@ -0,0 +1 @@
Added support in content app for properly handling unknown or forbidden digest errors.
8 changes: 7 additions & 1 deletion pulpcore/content/handler.py
Expand Up @@ -30,6 +30,7 @@
Remote,
RemoteArtifact,
)
from pulpcore.exceptions import UnsupportedDigestValidationError # noqa: E402

from jinja2 import Template # noqa: E402: module level not at top of file

Expand Down Expand Up @@ -501,7 +502,12 @@ async def _stream_content_artifact(self, request, response, content_artifact):
response = await self._stream_remote_artifact(request, response, remote_artifact)
return response

except ClientResponseError:
except (ClientResponseError, UnsupportedDigestValidationError) as e:
log.warn(
_("Could not download remote artifact at '{}': {}").format(
remote_artifact.url, str(e)
)
)
continue

raise HTTPNotFound()
Expand Down

0 comments on commit 8a77316

Please sign in to comment.