#541 closed defect (fixed)
Mime type mess with files downloaded with Browse
Reported by: | sayamindu | Owned by: | erikos |
---|---|---|---|
Priority: | Unspecified by Maintainer | Milestone: | |
Component: | Browse | Version: | 0.82.x |
Severity: | Blocker | Keywords: | |
Cc: | tomeu, sascha_silbe | Distribution/OS: | Unspecified |
Bug Status: | Unconfirmed |
Description
Files which are normally zip files (eg: Open Document files, Epub files, etc) seem to have the extension set to application/x-zip in the datastore. Steps to reproduce
- Open Browse and navigate to http://feedbooks.com/book/102
- Download the epub file linked from that page
- Try to open the file from the journal (you can have a mock activity which has the mimetype for application/epub+zip registered)
- View the log for Journal: it contains a line which says:
WARNING root: No activity can open this object, application/x-zip.
This normally occurs when the extension of the file is truncated, which means that there is no way to distinguish the file from a normal zip file.
I have seen this occur on Sucrose 0.82, on XO OS build 767
Attachments (2)
Change History (9)
Changed 14 years ago by sayamindu
comment:1 Changed 14 years ago by tomeu
- Severity changed from Major to Blocker
comment:2 Changed 14 years ago by erikos
- Milestone changed from Unspecified by Release Team to 0.84
comment:3 Changed 14 years ago by tomeu
Would this patch help with zip-based file types? I would prefer not discarding always the mime type sent by the server because many webapps would break that way.
diff --git a/downloadmanager.py b/downloadmanager.py index e41d06f..69d1c8a 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -180,7 +180,8 @@ class Download: self.dl_jobject.metadata['progress'] = '100' self.dl_jobject.file_path = self._target_file.path - if self._mime_type == 'application/octet-stream': + if self._mime_type in ['application/octet-stream', + 'application/x-zip']: sniffed_mime_type = mime.get_for_file(self._target_file.path) self.dl_jobject.metadata['mime_type'] = sniffed_mime_type
comment:4 Changed 14 years ago by tomeu
Also, you may want to add an icon and a parent mime type. From the odt file:
<sub-class-of type="application/zip"/> <generic-icon name="x-office-document"/>
comment:5 Changed 14 years ago by sascha_silbe
- Cc sascha_silbe added
comment:6 Changed 14 years ago by tomeu
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
As per discussion on IRC, I also included a mimetype.xml file in my activity. It did not seem to fix the problem