Bug 12030 - application/octet-stream is returned for text files
Summary: application/octet-stream is returned for text files
Status: RESOLVED MOVED
Alias: None
Product: xdgmime
Classification: Unclassified
Component: xdgmime (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-16 11:37 UTC by Tomeu Vizoso
Modified: 2018-10-13 10:33 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Tomeu Vizoso 2007-08-16 11:37:46 UTC
xdg_mime_get_mime_type_for_file() returns application/octet-stream for files without a recognized extension.

If I understand correctly the spec, some effort should be done to distinguish between binary files and text files:

"If nothing matches, the default type of application/octet-stream should be used for binary data, or text/plain for textual data. Checking the first 32 bytes of the file for ASCII control characters is a good way to guess whether a file is binary or text, but note that files with high-bit-set characters should still be treated as text since these can appear in UTF-8 text, unlike control characters."

gnomevfs does this in _gnome_vfs_get_mime_type_internal(), calling _gnome_vfs_sniff_buffer_looks_like_text().
Comment 1 GitLab Migration User 2018-10-13 10:33:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdgmime/issues/3.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.