From 42ccfd5dc5bd67dbb71c5410187875f09253ab36 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Wed, 4 Sep 2019 13:05:58 +0200 Subject: [PATCH] Do not abuse serverName to store browserName --- lib/manager/basedownload.ts | 8 ++++++-- lib/manager/download.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/manager/basedownload.ts b/lib/manager/basedownload.ts index 94b572f..7ceaec8 100644 --- a/lib/manager/basedownload.ts +++ b/lib/manager/basedownload.ts @@ -27,6 +27,7 @@ const SAVEDPROPS = [ "written", // server stuff "serverName", + "browserName", "mime", "prerolled", // other options @@ -41,6 +42,7 @@ const DEFAULTS = { state: QUEUED, error: "", serverName: "", + browserName: "", fileName: "", totalSize: 0, written: 0, @@ -95,6 +97,8 @@ export class BaseDownload { public serverName: string; + public browserName: string; + public mime: string; public mask: string; @@ -135,7 +139,7 @@ export class BaseDownload { } get currentName() { - return this.serverName || this.dest.name || this.finalName; + return this.browserName || this.dest.name || this.finalName; } get urlName() { @@ -175,7 +179,7 @@ export class BaseDownload { rv.destName = dest.name; rv.destPath = dest.path; rv.destFull = dest.full; - rv.currentName = this.serverName || rv.destName || rv.finalName; + rv.currentName = this.browserName || rv.destName || rv.finalName; rv.error = this.error; rv.ext = this.renamer.p_ext; return rv; diff --git a/lib/manager/download.ts b/lib/manager/download.ts index a4da405..db02947 100644 --- a/lib/manager/download.ts +++ b/lib/manager/download.ts @@ -374,7 +374,7 @@ export class Download extends BaseDownload { this.prerolled = false; this.manId = 0; this.written = this.totalSize = 0; - this.mime = this.serverName = ""; + this.mime = this.serverName = this.browserName = ""; } async removeFromBrowser() { @@ -451,7 +451,7 @@ export class Download extends BaseDownload { const state = (await downloads.search({id: this.manId})).pop(); const {filename, error} = state; const path = parsePath(filename); - this.serverName = path.name; + this.browserName = path.name; this.adoptSize(state); if (!this.mime && state.mime) { this.mime = state.mime;