mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Fix handling of UNC file URLs
- Qt thinks UNC URLs should look like: file://1.2.3.4/share/file.img libcurl likes them: file:////1.2.3.4/share/file.img So correct that. - Mention it is an unspecified libcurl error if libcurl passes us an error code with an empty error message string. Closes #65
This commit is contained in:
parent
3248f9f04b
commit
71eefa47cf
1 changed files with 12 additions and 1 deletions
|
@ -266,6 +266,14 @@ void DownloadThread::run()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "Image URL:" << _url;
|
||||||
|
if (_url.startsWith("file://") && _url.at(7) != '/')
|
||||||
|
{
|
||||||
|
/* libcurl does not like UNC paths in the form of file://1.2.3.4/share */
|
||||||
|
_url.replace("file://", "file:////");
|
||||||
|
qDebug() << "Corrected UNC URL to:" << _url;
|
||||||
|
}
|
||||||
|
|
||||||
char errorBuf[CURL_ERROR_SIZE] = {0};
|
char errorBuf[CURL_ERROR_SIZE] = {0};
|
||||||
_c = curl_easy_init();
|
_c = curl_easy_init();
|
||||||
curl_easy_setopt(_c, CURLOPT_NOSIGNAL, 1);
|
curl_easy_setopt(_c, CURLOPT_NOSIGNAL, 1);
|
||||||
|
@ -332,6 +340,9 @@ void DownloadThread::run()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
deleteDownloadedFile();
|
deleteDownloadedFile();
|
||||||
|
if (!errorBuf[0])
|
||||||
|
_onDownloadError("Unspecified libcurl error");
|
||||||
|
else
|
||||||
_onDownloadError(errorBuf);
|
_onDownloadError(errorBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue