downthemall / anticontainer

DownThemAll! AntiContainer (Extension to a Firefox, Seamonkey extension)
Mozilla Public License 2.0
93 stars 41 forks source link

QueueDownload's NameSuggestion uses wrong/invalid function name #108

Closed MegaScience closed 8 years ago

MegaScience commented 8 years ago

I was attempting to pass a nameSuggestion to the queueDownload function, and noticed the parent download hanging with newly queued downloads being spawned using the default name. When viewing DownThemAll's debug logs, I found AntiContainer was calling an undefined function called "makeName". Inspecting manager.js, I believe the intended function was "makeFileName". I assume "makeName" was an earlier name for the function which was changed later.

The code in question, via anticontainer/content/manager.js:

function SpawnedQueueItem(inst, item) {
    let nu = inst.composeURL(
        inst.req ? inst.req.channel.URI.spec : inst.download.urlManager.url.spec,
        inst.decode ? decodeURIComponent(item.url) : item.url
    );
    this.url = nu.url;
    if (!!item.nameSuggestion) {
        this.destinationName = this.fileName = makeName(item.nameSuggestion);
    }
}

Summary: manager.js uses "makeName" instead of "makeFileName" when working with newly queued downloads with a nameSuggestion, which breaks the download process. Changing this to the correct function should fix this.