Opened 9 years ago

Closed 5 years ago

#2267 closed defect (fixed)

Do we get the right file extension with mime.get_primary_extension(mime_type) ?

Reported by: erikos Owned by: tomeu
Priority: Low Milestone: Unspecified
Component: Sugar Version: Git as of bugdate
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

I copied a photo taken with Record on a usb key. The file extension shown when inserting on another machine was .jpe Since I did not knew that extension I checked the Sugar code path. What we actually do is, we merge all the existing mime/globs in a dictionary with the given mime type as key and then get the value of that key.

jfif
jpeg
jpg
jpe

In the blobs there are 4 keys (image/jpeg) and hence we do overwrite the value and end up with the last key-value pair found - in this case 'jpe'.

http://git.sugarlabs.org/projects/sugar-base/repos/mainline/blobs/master/src/sugar/mime.py#line144

Not sure there is a good priority one should follow. Maybe we should check what nautilus or others do, or define the extensions for the most common cases.

Change History (3)

comment:2 Changed 5 years ago by tch

  • Priority changed from Unspecified by Maintainer to Low

I have taken a photo in Record, copied this photo to a USB key and then checked this photo extension from another laptop.

The extension was ".jpeg", with mime type "image/jpeg".

I can't find any change that is related to this issue, so I assumed this could have been fixed indirectly at some point, or other changes could have simply influenced the outcome of this particular test scenario.

Therefore, I will simply put this a low priority.

comment:3 Changed 5 years ago by godiard

  • Resolution set to fixed
  • Status changed from new to closed

I think this was fixed when we moved to use Gio.content_type_guess
Commits:
b02ade879a46fd4b692dc62891c2c5f47694d9ab
faa0d42084979400104032299936c84606afcd7b
7678540056ec0d3052725c3b3a6c49751041af75

Note: See TracTickets for help on using tickets.