| Summary: | Toaster does not set a correct MIME type for tasks' logs files | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Toaster | Reporter: | Leif Middelschulte <Leif.Middelschulte> |
| Component: | toaster | Assignee: | Toaster default assignee <toaster> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | Low | CC: | belen.barros.pena, brian.avery, david.reyna, jessica.zhang, jose.perez.carranza, joshuagloe, stanciux.mihail |
| Version: | unspecified | ||
| Target Milestone: | Future | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
|
Description
Leif Middelschulte
2016-05-24 11:38:43 UTC
Would be better to use python-magic rather than the Python mimetypes module, as the mimetypes module relies on file extensions and log files use the PID for the file extension. we could try something like:
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -67,7 +67,10 @@ class MimeTypeFinder(object):
guess = mimetypes.guess_type(path, self._strict)
guessed_type = guess[0]
if guessed_type == None:
- guessed_type = 'application/octet-stream'
+ if "log.do_" in os.path.basename(path):
+ guessed_type = 'text/plain'
+ else:
+ guessed_type = 'application/octet-stream'
return guessed_type
since we are already providing a base guess at least it would keep any special cases in one place.
|