Do not abuse serverName to store browserName

This commit is contained in:
Nils Maier 2019-09-04 13:05:58 +02:00
parent dabf7f8a28
commit 42ccfd5dc5
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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;