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

Commit 5a838b0

Browse files
committed
Fix loading file as text in Firefox
1 parent 3954969 commit 5a838b0

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

extension/background.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020

21-
// TODO: LocalStorage support for Firefox (how does this work here?)
2221

2322
var interruptDownloads = true;
2423
var ugetWrapperNotFound = true;
@@ -59,7 +58,8 @@ try {
5958
current_browser.runtime.getBrowserInfo().then(
6059
function(info) {
6160
if (info.name === 'Firefox') {
62-
firefoxVersion = info.version.replace(/[ab]\d+/, '');
61+
// Convert version string to int
62+
firefoxVersion = parseInt(info.version.replace(/[ab]\d+/, '').split('.')[0]);
6363
}
6464
}
6565
);
@@ -71,7 +71,7 @@ try {
7171

7272
chromeVersion = parseInt(chromeVersion);
7373
sendMessageToHost({
74-
version: "2.0.6"
74+
version: "2.0.7"
7575
});
7676

7777
// Read the local storage for excluded keywords
@@ -152,6 +152,10 @@ current_browser.downloads.onCreated.addListener(function(downloadItem) {
152152
return;
153153
}
154154

155+
if("in_progress" !== downloadItem['state'].toString().toLowerCase()) {
156+
return;
157+
}
158+
155159
var fileSize = downloadItem['fileSize'];
156160

157161
var url = '';
@@ -174,7 +178,7 @@ current_browser.downloads.onCreated.addListener(function(downloadItem) {
174178
});
175179

176180
message.url = url;
177-
message.filename = downloadItem['filename'];
181+
message.filename = downloadItem['filename'].replace(/^.*[\\\/]/, '');
178182
message.filesize = fileSize;
179183
message.referrer = downloadItem['referrer'];
180184
current_browser.cookies.getAll({ 'url': extractRootURL(url) }, parseCookies);

extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
"storage",
5050
"cookies"
5151
],
52-
"version": "2.0.6"
52+
"version": "2.0.7"
5353
}

extension/popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<body>
2929
<div id="parent-container">
3030
<div id="title-container">
31-
<img id="img-icon" src="icon_32.png" /> <span>uGet Integration 2.0.6</span>
31+
<img id="img-icon" src="icon_32.png" /> <span>uGet Integration 2.0.7</span>
3232
</div>
3333
<hr>
3434
<label id="info"></label><label id="error"></label><label id="warn"></label>

0 commit comments

Comments
 (0)