Actions
Issue #5507
closedcontent-app always sets Content-Type header to 'application/octet-stream'
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 60
Quarter:
Description
The FileResponse from aiohttp tries to guess the content type by looking at the extension of the filename. The content-app is always handing the FileResponse object an Artifact file that doesn't have an extension. As a result the Content-Type cannot be inferred.
We should manually mimetypes.guesstype[0] function that aiohttp already uses for guessing the content type, but pass it the 'relative_path' from the content artifact. We can then use the values returned as parameters for FileResponse object.
[0] https://docs.python.org/3.6/library/mimetypes.html#mimetypes.guess_type
Actions
Set Content-Type and Content-Encoding headers in content-app responses
closes: #5507 https://pulp.plan.io/issues/5507