diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2020-01-11 09:24:23 -0700 |
|---|---|---|
| committer | Chris Bessent <lost.dragonist@gmail.com> | 2020-01-11 09:24:23 -0700 |
| commit | 9fc7a1bf8530e76f4300d495400bba8a67ab45b1 (patch) | |
| tree | fe4242e4c3c325035c1b75da25e2a2a8a627799b /src | |
| parent | 3cfa7bbe74e0f72a08a6f9f1c366f4ed21aca6d5 (diff) | |
Fix downloading files that have no file name
Somehow some mods on the Nexus have no file name in certain API
responses. Previously, MO assumed the last part of the URL is
the file name. This worked until the Nexus started adding URL
query stuff to the URL (?md5=xxx).
Now, strip out all the URL query stuff to get a valid file name.
Diffstat (limited to 'src')
| -rw-r--r-- | src/downloadmanager.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 34eebf0c..f5db53bf 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -432,6 +432,13 @@ bool DownloadManager::addDownload(QNetworkReply *reply, const QStringList &URLs, } } + // baseName could be a URL at this point so strip out the URL query + int queryIndex = baseName.indexOf("?"); + if (queryIndex >= 0) + { + baseName.truncate(queryIndex); + } + startDisableDirWatcher(); newDownload->setName(getDownloadFileName(baseName), false); endDisableDirWatcher(); |
