Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Commit

Permalink
fix wrong type of download directory
Browse files Browse the repository at this point in the history
  • Loading branch information
harytfw committed Jun 8, 2022
1 parent 52d4eaa commit c2ddb43
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class ExecutorClass {
}
else {
const directories = (await LStorage.get("downloadDirectories"))["downloadDirectories"];
opt.filename = this.replaceVariables(directories[this.action.download_directory])
opt.filename = this.replaceVariables(directories[parseInt(this.action.download_directory)])
opt.filename += aFilename;
}
opt.filename = decodeURIComponent(opt.filename);
Expand Down Expand Up @@ -641,6 +641,12 @@ browser.runtime.onInstalled.addListener(async (details) => {
if (typeof target !== 'object' || typeof origin !== 'object') {
return
}
// DIRTY HACK:
if (Array.isArray(target) && Array.isArray(origin) ) {
if(target.length !== origin.length) {
return
}
}
for (const aKey of Object.keys(origin)) {
if (typeof target[aKey] === "object" && typeof origin[aKey] === 'object') {
assign(target[aKey], origin[aKey]);
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"description": "__MSG_extensionDescription__",
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.56.10",
"version": "1.56.11",
"homepage_url": "https://github.com/harytfw/GlitterDrag",
"icons": {
"128": "/icon/drag.png"
Expand Down
11 changes: 10 additions & 1 deletion src/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ class ActionsWrapper {
else if (e.target.value === "false") {
res[key][kind][dirName][attribute] = false;
}
else if (attribute === "download_directory") {
res[key][kind][dirName][attribute] = parseInt(e.target.value);
}
else if (attribute === "engine_name") {
const prefix = getI18nMessage('currentEngine');
if (e.target.value.startsWith(prefix)) {
Expand Down Expand Up @@ -989,7 +992,7 @@ class ActionsView {
engine_name: this.$E(".search-engine-name").value,
engine_url: this.$E(".search-engine-url").value,
is_browser_search: this.$E(".search-engine-is-browser-search").value === "true" ? true : false,
download_directory: this.$E(".download-directory").value,
download_directory: parseInt(this.$E(".download-directory").value),
tab_active: this.getRadioValue(".tab-active"),
open_type: this.getRadioValue(".open-type"),
search_type: this.getRadioValue(".search-type"),
Expand Down Expand Up @@ -1691,6 +1694,12 @@ async function assignDefaultConfig() {
if (typeof target !== 'object' || typeof origin !== 'object') {
return
}
// DIRTY HACK:
if (Array.isArray(target) && Array.isArray(origin) ) {
if(target.length !== origin.length) {
return
}
}
for (const aKey of Object.keys(origin)) {
if (typeof target[aKey] === "object" && typeof origin[aKey] === 'object') {
assign(target[aKey], origin[aKey]);
Expand Down

0 comments on commit c2ddb43

Please sign in to comment.