Attachments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #3512: 0001-Fix-for-the-MIME-type-handling-of-a-request-SL-3512.3.patch

File 0001-Fix-for-the-MIME-type-handling-of-a-request-SL-3512.3.patch, 1.6 KB (added by manuq, 13 months ago)

v3

  • browser.py

    From f38d3c986423ecfc61962f29b6aa95894328b937 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Wed, 2 May 2012 13:04:31 -0300
    Subject: [PATCH v2 Browse] Fix for the MIME type handling of a request SL
     #3512
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    We were not returning the right value, the callback
    should return True if the signal is handled, False otherwise.
    
    This fixes http://bugs.sugarlabs.org/ticket/3512
    
    -----
    
    v1 -> v2: fixed regression with PDF handling.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     browser.py |   11 ++++++-----
     1 files changed, 6 insertions(+), 5 deletions(-)
    
    diff --git a/browser.py b/browser.py
    index c0bb7bc..a40cc03 100644
    a b  
    532532 
    533533    def __mime_type_policy_cb(self, webview, frame, request, mimetype, 
    534534                              policy_decision): 
     535        """Handle downloads and PDF files.""" 
    535536        if mimetype == 'application/pdf': 
    536537            self.emit('open-pdf', request.get_uri()) 
    537             return False 
    538         elif self.can_show_mime_type(mimetype): 
    539             return True 
    540         else: 
     538 
     539        elif not self.can_show_mime_type(mimetype): 
    541540            policy_decision.download() 
    542         return True 
     541            return True 
     542 
     543        return False 
    543544 
    544545    def __new_window_policy_cb(self, webview, webframe, request, 
    545546                               navigation_action, policy_decision):