Ticket #1040 (closed defect: fixed)
Traceback when copying file of unknown MIME type to USB stick
| Reported by: | sascha_silbe | Owned by: | tomeu |
|---|---|---|---|
| Priority: | Unspecified by Maintainer | Milestone: | 0.86 |
| Component: | sugar | Version: | Git as of bugdate |
| Severity: | Unspecified | Keywords: | r+ |
| Cc: | Distribution/OS: | Unspecified | |
| Bug Status: | New |
Description
When trying to copy a Calculate instance I get the following traceback:
Traceback (most recent call last):
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/journal/volumestoolbar.py", line 141, in _drag_data_received_cb
model.copy(metadata, self.mount_point)
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/journal/model.py", line 459, in copy
return write(metadata, file_path)
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/journal/model.py", line 487, in write
file_name = _get_file_name(metadatatitle?, metadatamime_type?)
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/journal/model.py", line 499, in _get_file_name
extension = '.' + mime.get_primary_extension(mime_type)
TypeError: cannot concatenate 'str' and 'NoneType' objects
This is because sugar.mime.get_primary_extension() returns None if no extension for the given MIME type is known.
The attached patch handles this case by substituting the empty string instead.

