Issue #5507
closedcontent-app always sets Content-Type header to 'application/octet-stream'
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
Updated by dkliban@redhat.com about 5 years ago
- Status changed from NEW to POST
- Sprint set to Sprint 59
Added by dkliban@redhat.com about 5 years ago
Added by dkliban@redhat.com about 5 years ago
Revision 9a597243 | View on GitHub
Set Content-Type and Content-Encoding headers for StreamedResponse
Updated by dkliban@redhat.com about 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|9df8b2b9190a92ffa0d4da4574fdc668e596be29.
Updated by dkliban@redhat.com about 5 years ago
Applied in changeset pulpcore|9a5972430b5aa54032f31f2c89403cade1d07d69.
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Set Content-Type and Content-Encoding headers in content-app responses
closes: #5507 https://pulp.plan.io/issues/5507