Fixes issue #2105 by using the original url for the download. This fix is

valid because we expect the url to contain the actual filename at the end.
This also allows huggingface to track the download as happening.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
Adam Treat 2024-03-11 12:25:40 -04:00 committed by AT
parent a6a3e0048a
commit 0daf37ab8a

View File

@ -1922,7 +1922,7 @@ void ModelList::handleDiscoveryItemFinished()
QString repoCommit = QString::fromUtf8(repoCommitHeader);
QString linkedSize = QString::fromUtf8(linkedSizeHeader);
QString linkedEtag = QString::fromUtf8(linkedEtagHeader);
QString url = locationHeader;
QString modelFilename = reply->request().attribute(QNetworkRequest::UserMax).toString();
QString modelFilesize = linkedSize;
modelFilesize = ModelList::toFileSize(modelFilesize.toULongLong());
@ -1953,7 +1953,7 @@ void ModelList::handleDiscoveryItemFinished()
{ ModelList::FilesizeRole, modelFilesize },
{ ModelList::DescriptionRole, description },
{ ModelList::IsDiscoveredRole, true },
{ ModelList::UrlRole, url },
{ ModelList::UrlRole, reply->request().url() },
{ ModelList::LikesRole, likes },
{ ModelList::DownloadsRole, downloads },
{ ModelList::RecencyRole, lastModified },