#9953 NORM 1.5-sof: Can not open pdf from usb key (was: PDF can not open by using Read activity.)

Zarro Boogs per Child bugtracker at laptop.org
Wed May 19 10:10:47 EDT 2010


#9953: Can not open pdf from usb key
-------------------------------------+--------------------------------------
           Reporter:  Andy Pei       |       Owner:  erikos                           
               Type:  defect         |      Status:  new                              
           Priority:  normal         |   Milestone:  1.5-software-later               
          Component:  read-activity  |     Version:  Development build as of this date
         Resolution:                 |    Keywords:                                   
        Next_action:  package        |    Verified:  0                                
Deployment_affected:                 |   Blockedby:                                   
           Blocking:                 |  
-------------------------------------+--------------------------------------
Changes (by erikos):

  * owner:  sayamindu => erikos
  * next_action:  diagnose => package


Comment:

 After some debugging I found out that the issue is not directly in read,
 it is in sugar-base. There is some symlinking happening which we do not
 scope for and we pass an uri to the mime function. I was lucky, that it
 was already fixed upstream (thanks to Aleksey and Sascha), will make it
 available in the 0.84 branch.

 {{{
 diff --git a/src/sugar/mime.py b/src/sugar/mime.py
 index 7d3b54b..a60fe63 100644
 --- a/src/sugar/mime.py
 +++ b/src/sugar/mime.py
 @@ -89,6 +89,11 @@ def get_all_generic_types():
      return types

  def get_for_file(file_name):
 +    if file_name.startswith('file://'):
 +        file_name = file_name[7:]
 +
 +    file_name = os.path.realpath(file_name)
 +
      mime_type = _sugarbaseext.get_mime_type_for_file(file_name)
      if mime_type == 'application/octet-stream':
          if _file_looks_like_text(file_name):
 }}}

-- 
Ticket URL: <http://dev.laptop.org/ticket/9953#comment:8>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list