Bug 9670 - Toaster does not set a correct MIME type for tasks' logs files
Summary: Toaster does not set a correct MIME type for tasks' logs files
Status: NEW
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Low normal
Target Milestone: Future
Assignee: Toaster default assignee
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-05-24 11:38 UTC by Leif Middelschulte
Modified: 2023-12-14 04:19 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leif Middelschulte 2016-05-24 11:38:43 UTC
Toaster (i.e. "source toaster start) does not set the correct header for tasks' log files. This leads to browsers not offering to open the files in place, resulting in an annoying work flow.
Comment 1 Elliot Smith 2016-05-25 15:38:17 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.
Comment 2 brian avery 2016-05-25 16:34:34 UTC
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.