Merge lp:~gue5t/midori/fix-1182304 into lp:midori

Proposed by gue5t gue5t
Status: Merged
Approved by: André Stösel
Approved revision: 6174
Merged at revision: 6175
Proposed branch: lp:~gue5t/midori/fix-1182304
Merge into: lp:midori
Diff against target: 34 lines (+7/-7)
1 file modified
extensions/external-download-manager.vala (+7/-7)
To merge this branch: bzr merge lp:~gue5t/midori/fix-1182304
Reviewer Review Type Date Requested Status
André Stösel Approve
Review via email: mp+165792@code.launchpad.net

Commit message

make commandline download-manager handle parameters more consistently, fixing nullable strings

To post a comment you must log in.
Revision history for this message
André Stösel (ivaldi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/external-download-manager.vala'
2--- extensions/external-download-manager.vala 2013-02-08 18:25:40 +0000
3+++ extensions/external-download-manager.vala 2013-05-26 18:46:27 +0000
4@@ -147,7 +147,7 @@
5
6 var headers = value_array_new ();
7 if (dlReq.cookie_header != null) {
8- value_array_insert (headers, 0, typeof (string), "Cookie: %s".printf(dlReq.cookie_header));
9+ value_array_insert (headers, 0, typeof (string), "Cookie: " + dlReq.cookie_header);
10 }
11
12 if (headers.n_values > 0)
13@@ -273,15 +273,15 @@
14 dialog.show ();
15 }
16
17+ private string replace_quoted (string context, string replace, string? with) {
18+ return context.replace(replace, with != null ? GLib.Shell.quote(with) : "\'\'");
19+ }
20+
21 public override bool download (DownloadRequest dlReq) {
22 try {
23 string cmd = this.get_string ("commandline");
24- cmd = cmd.replace("{REFERER}", GLib.Shell.quote (dlReq.referer));
25- if (dlReq.cookie_header != null) {
26- cmd = cmd.replace("{COOKIES}", GLib.Shell.quote ("Cookie: " + dlReq.cookie_header));
27- } else {
28- cmd = cmd.replace("{COOKIES}", "\'\'");
29- }
30+ cmd = replace_quoted(cmd, "{REFERER}", dlReq.referer);
31+ cmd = replace_quoted(cmd, "{COOKIES}", dlReq.cookie_header != null ? "Cookie: " + dlReq.cookie_header : null);
32 cmd = cmd.replace("{URL}", GLib.Shell.quote (dlReq.uri));
33 GLib.Process.spawn_command_line_async (cmd);
34 return true;

Subscribers

People subscribed via source and target branches

to all changes: