Attachments you submit will be routed for moderation. If you have an account, please
log in first.
Ticket #3556: 0001-Automatically-download-attachment-files-SL-3556.patch
|
File 0001-Automatically-download-attachment-files-SL-3556.patch, 1.5 KB
(added by humitos, 13 months ago)
|
|
|
-
From bfd50c1d86068c09651a576edd84fcd491d20f7a Mon Sep 17 00:00:00 2001
Message-Id: <bfd50c1d86068c09651a576edd84fcd491d20f7a.1336104522.git.humitos@gmail.com>
From: Manuel Kaufmann <humitos@gmail.com>
Date: Fri, 4 May 2012 01:08:34 -0300
Subject: [PATCH Browse] Automatically download "attachment" files SL #3556
Check for "attachment" in Content-Disposition header and download the
file automatically if it matches. This is a RFC specification.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
browser.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/browser.py b/browser.py
index c0bb7bc..bf046a2 100644
|
a
|
b
|
|
| 532 | 532 | |
| 533 | 533 | def __mime_type_policy_cb(self, webview, frame, request, mimetype, |
| 534 | 534 | policy_decision): |
| | 535 | |
| | 536 | # We have to download the file if the Content-Disposition |
| | 537 | # header is "attachment" |
| | 538 | network_response = frame.get_network_response() |
| | 539 | if network_response: |
| | 540 | message = network_response.get_message() |
| | 541 | if message: |
| | 542 | content_disposition = message.props.\ |
| | 543 | response_headers.get_content_disposition() |
| | 544 | if content_disposition == 'attachment': |
| | 545 | policy_decision.download() |
| | 546 | return True |
| | 547 | |
| 535 | 548 | if mimetype == 'application/pdf': |
| 536 | 549 | self.emit('open-pdf', request.get_uri()) |
| 537 | 550 | return False |
Download in other formats: