From 0daf37ab8a23ae0d494e65a7211fff3c774186c1 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Mon, 11 Mar 2024 12:25:40 -0400 Subject: [PATCH] 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 --- gpt4all-chat/modellist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpt4all-chat/modellist.cpp b/gpt4all-chat/modellist.cpp index d373e23e..69e13345 100644 --- a/gpt4all-chat/modellist.cpp +++ b/gpt4all-chat/modellist.cpp @@ -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 },