Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit 4e173d3

Browse files
committed
Fix underscores in filename
1 parent e65e378 commit 4e173d3

File tree

2 files changed

+71
-71
lines changed

2 files changed

+71
-71
lines changed

extension/background.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,27 @@ current_browser.storage.sync.get(function(items) {
7979
if (items["uget-keywords-exclude"]) {
8080
keywordsToExclude = items["uget-keywords-exclude"].split(/[\s,]+/);
8181
} else {
82-
current_browser.storage.sync.set({"uget-keywords-exclude": ''});
82+
current_browser.storage.sync.set({ "uget-keywords-exclude": '' });
8383
}
8484

8585
// Read the local storage for included keywords
8686
if (items["uget-keywords-include"]) {
8787
keywordsToInclude = items["uget-keywords-include"].split(/[\s,]+/);
8888
} else {
89-
current_browser.storage.sync.set({"uget-keywords-include": ''});
89+
current_browser.storage.sync.set({ "uget-keywords-include": '' });
9090
}
9191

9292
// Read the local storage for the minimum file-size to interrupt
9393
if (items["uget-min-file-size"]) {
9494
minFileSizeToInterrupt = parseInt(items["uget-min-file-size"]);
9595
} else {
96-
current_browser.storage.sync.set({"uget-min-file-size": minFileSizeToInterrupt});
96+
current_browser.storage.sync.set({ "uget-min-file-size": minFileSizeToInterrupt });
9797
}
9898

9999
// Read the local storage for enabled flag
100100
if (!items["uget-interrupt"]) {
101101
// Keep the value string
102-
current_browser.storage.sync.set({"uget-interrupt": 'true'});
102+
current_browser.storage.sync.set({ "uget-interrupt": 'true' });
103103
} else {
104104
var interrupt = (items["uget-interrupt"] == "true");
105105
setInterruptDownload(interrupt);
@@ -144,18 +144,18 @@ current_browser.contextMenus.create({
144144
id: "download_all_links_with_uget",
145145
contexts: ['page']
146146
});
147-
147+
148148
current_browser.contextMenus.onClicked.addListener(function(info, tab) {
149149
"use strict";
150150
if (info.menuItemId === "download_with_uget") {
151151
message.url = info['linkUrl'];
152152
message.referrer = info['pageUrl'];
153153
current_browser.cookies.getAll({ 'url': extractRootURL(info.pageUrl) }, parseCookies);
154154
} else if (info.menuItemId === "download_all_links_with_uget") {
155-
var dataToWebPage = {text: 'test', foo: 1, bar: false};
156-
current_browser.tabs.executeScript(null, {file: 'extract.js'}, function(results) {
155+
var dataToWebPage = { text: 'test', foo: 1, bar: false };
156+
current_browser.tabs.executeScript(null, { file: 'extract.js' }, function(results) {
157157
// Do nothing
158-
if(results[0].success) {
158+
if (results[0].success) {
159159
message.url = results[0].urls;
160160
message.referrer = info['pageUrl'];
161161
message.batch = true;
@@ -172,7 +172,7 @@ current_browser.downloads.onCreated.addListener(function(downloadItem) {
172172
return;
173173
}
174174

175-
if("in_progress" !== downloadItem['state'].toString().toLowerCase()) {
175+
if ("in_progress" !== downloadItem['state'].toString().toLowerCase()) {
176176
return;
177177
}
178178

@@ -198,7 +198,7 @@ current_browser.downloads.onCreated.addListener(function(downloadItem) {
198198
});
199199

200200
message.url = url;
201-
message.filename = unescape(downloadItem['filename']);
201+
message.filename = unescape(downloadItem['filename']).replace(/\"/g, "");
202202
message.filesize = fileSize;
203203
message.referrer = downloadItem['referrer'];
204204
current_browser.cookies.getAll({ 'url': extractRootURL(url) }, parseCookies);
@@ -290,7 +290,7 @@ current_browser.webRequest.onHeadersReceived.addListener(function(details) {
290290
disposition = details.responseHeaders[i].value;
291291
if (disposition.lastIndexOf('filename') != -1) {
292292
message.filename = disposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/)[1];
293-
message.filename = unescape(message.filename);
293+
message.filename = unescape(message.filename).replace(/\"/g, "");
294294
interruptDownload = true;
295295
}
296296
} else if (details.responseHeaders[i].name.toLowerCase() == 'content-type') {
@@ -466,8 +466,8 @@ function parseCookies(cookies_arr) {
466466
function updateKeywords(include, exclude) {
467467
keywordsToInclude = include.split(/[\s,]+/);
468468
keywordsToExclude = exclude.split(/[\s,]+/);
469-
current_browser.storage.sync.set({"uget-keywords-include": include});
470-
current_browser.storage.sync.set({"uget-keywords-exclude": exclude});
469+
current_browser.storage.sync.set({ "uget-keywords-include": include });
470+
current_browser.storage.sync.set({ "uget-keywords-exclude": exclude });
471471
}
472472

473473
/**
@@ -476,7 +476,7 @@ function updateKeywords(include, exclude) {
476476
*/
477477
function updateMinFileSize(size) {
478478
minFileSizeToInterrupt = size;
479-
current_browser.storage.sync.set({"uget-min-file-size": size});
479+
current_browser.storage.sync.set({ "uget-min-file-size": size });
480480
}
481481

482482
/**
@@ -527,6 +527,6 @@ function setInterruptDownload(interrupt, writeToStorage) {
527527
});
528528
}
529529
if (writeToStorage) {
530-
current_browser.storage.sync.set({"uget-interrupt": interrupt.toString()});
530+
current_browser.storage.sync.set({ "uget-interrupt": interrupt.toString() });
531531
}
532-
}
532+
}

extension/manifest.json

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
{
2-
"applications": {
3-
"gecko": {
4-
"id": "uget-integration@slgobinath",
5-
"strict_min_version": "52.0"
6-
}
7-
},
8-
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnI/ECgghIqV+/wQ7b6N+m5tupHZlieWd6nbqqSoqmhUlFg3DmqOi2G/LpVhxoSGHnbRBnemoO2Hs+6aLnlpHKyJ1/DQUHwTjPnvGc9sjTvks1L1dKWTFGcJLiQZPMsjs5g1b8ZNQCH8nGE4uqeSzVK7Hey61gwsS5+OwZYw5/3C/HfBZNNzQfphm7j+eMTuXJTBowA3A3I2ywPRTSOt8n/CxZUIL9O44QOs/WiZFjtERnZocvbHmkWLproj1MIcJVJd0OI11VAfqYznuwsCTIe7annsBpWL1UJUNK+EwVW8Jpj4CUeauC5c0HUWdAecLyx01yKtfokBvwX5fldB1YQIDAQAB",
9-
"offline_enabled": true,
10-
"background": {
11-
"scripts": [
12-
"background.js"
13-
]
14-
},
15-
"browser_action": {
16-
"browser_style": true,
17-
"default_icon": "icon_32.png",
18-
"default_popup": "popup.html"
19-
},
20-
"content_scripts": [{
21-
"all_frames": true,
22-
"js": [
23-
"content.js",
24-
"extract.js"
25-
],
26-
"matches": [
27-
"http://*/*",
28-
"https://*/*"
29-
],
30-
"run_at": "document_start"
31-
}],
32-
"description": "uGet Browser Integration extension replaces default download manager by uGet Download Manager.",
33-
"homepage_url": "https://slgobinath.github.io/uget-chrome-wrapper",
34-
"icons": {
35-
"32": "icon_32.png",
36-
"48": "icon_48.png",
37-
"64": "icon_64.png",
38-
"128": "icon_128.png"
39-
},
40-
"manifest_version": 2,
41-
"minimum_chrome_version": "19.0",
42-
"name": "uGet Integration",
43-
"short_name": "uGet",
44-
"permissions": [
45-
"<all_urls>",
46-
"webRequest",
47-
"webRequestBlocking",
48-
"nativeMessaging",
49-
"contextMenus",
50-
"downloads",
51-
"storage",
52-
"cookies",
53-
"activeTab"
54-
],
55-
"version": "2.1.0"
56-
}
2+
"applications": {
3+
"gecko": {
4+
"id": "uget-integration@slgobinath",
5+
"strict_min_version": "52.0"
6+
}
7+
},
8+
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnI/ECgghIqV+/wQ7b6N+m5tupHZlieWd6nbqqSoqmhUlFg3DmqOi2G/LpVhxoSGHnbRBnemoO2Hs+6aLnlpHKyJ1/DQUHwTjPnvGc9sjTvks1L1dKWTFGcJLiQZPMsjs5g1b8ZNQCH8nGE4uqeSzVK7Hey61gwsS5+OwZYw5/3C/HfBZNNzQfphm7j+eMTuXJTBowA3A3I2ywPRTSOt8n/CxZUIL9O44QOs/WiZFjtERnZocvbHmkWLproj1MIcJVJd0OI11VAfqYznuwsCTIe7annsBpWL1UJUNK+EwVW8Jpj4CUeauC5c0HUWdAecLyx01yKtfokBvwX5fldB1YQIDAQAB",
9+
"offline_enabled": true,
10+
"background": {
11+
"scripts": [
12+
"background.js"
13+
]
14+
},
15+
"browser_action": {
16+
"browser_style": true,
17+
"default_icon": "icon_32.png",
18+
"default_popup": "popup.html"
19+
},
20+
"content_scripts": [{
21+
"all_frames": true,
22+
"js": [
23+
"content.js",
24+
"extract.js"
25+
],
26+
"matches": [
27+
"http://*/*",
28+
"https://*/*"
29+
],
30+
"run_at": "document_start"
31+
}],
32+
"description": "uGet Browser Integration extension replaces default download manager by uGet Download Manager.",
33+
"homepage_url": "https://slgobinath.github.io/uget-chrome-wrapper",
34+
"icons": {
35+
"32": "icon_32.png",
36+
"48": "icon_48.png",
37+
"64": "icon_64.png",
38+
"128": "icon_128.png"
39+
},
40+
"manifest_version": 2,
41+
"minimum_chrome_version": "19.0",
42+
"name": "uGet Integration",
43+
"short_name": "uGet",
44+
"permissions": [
45+
"<all_urls>",
46+
"webRequest",
47+
"webRequestBlocking",
48+
"nativeMessaging",
49+
"contextMenus",
50+
"downloads",
51+
"storage",
52+
"cookies",
53+
"activeTab"
54+
],
55+
"version": "2.1.0"
56+
}

0 commit comments

Comments
 (0)