Project

Profile

Help

Issue #5507

closed

content-app always sets Content-Type header to 'application/octet-stream'

Added by dkliban@redhat.com over 4 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
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

Also available in: Atom PDF