[Bugs] #541 UNSP: Mime type mess with files downloaded with Browse

SugarLabs Bugs bugtracker-noreply at sugarlabs.org
Fri Mar 27 09:06:07 EDT 2009


#541: Mime type mess with files downloaded with Browse
------------------------------------------+---------------------------------
    Reporter:  sayamindu                  |          Owner:  erikos     
        Type:  defect                     |         Status:  new        
    Priority:  Unspecified by Maintainer  |      Milestone:  0.84       
   Component:  Browse                     |        Version:  0.82.x     
    Severity:  Blocker                    |     Resolution:             
    Keywords:                             |   Distribution:  Unspecified
Status_field:  Unconfimed                 |  
------------------------------------------+---------------------------------

Comment(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


 }}}

-- 
Ticket URL: <http://dev.sugarlabs.org/ticket/541#comment:3>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list