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:
@@ -266,6 +266,14 @@ void DownloadThread::run()
|
||||
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};
|
||||
_c = curl_easy_init();
|
||||
curl_easy_setopt(_c, CURLOPT_NOSIGNAL, 1);
|
||||
@@ -332,6 +340,9 @@ void DownloadThread::run()
|
||||
break;
|
||||
default:
|
||||
deleteDownloadedFile();
|
||||
if (!errorBuf[0])
|
||||
_onDownloadError("Unspecified libcurl error");
|
||||
else
|
||||
_onDownloadError(errorBuf);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user