Ticket #4715: get_mime_from_gio_if_indeterminated.diff

File get_mime_from_gio_if_indeterminated.diff, 550 bytes (added by godiard, 10 years ago)
  • src/sugar3/mime.py

    diff --git a/src/sugar3/mime.py b/src/sugar3/mime.py
    index e08336f..7836e5a 100644
    a b def get_for_file(file_name): 
    126126
    127127    mime_type = SugarExt.mime_get_mime_type_for_file(file_name, None)
    128128    if mime_type == 'application/octet-stream':
     129
     130        mime_type = Gio.content_type_guess(file_name, None)[0]
     131        if mime_type != 'application/octet-stream':
     132            return mime_type
     133
    129134        if _file_looks_like_text(file_name):
    130135            return 'text/plain'
    131136        else: