Bug 12030

Summary: application/octet-stream is returned for text files
Product: xdgmime Reporter: Tomeu Vizoso <tomeu.vizoso>
Component: xdgmimeAssignee: Jonathan Blandford <jrb>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

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.