Fix core.download_file() creating empty files on HTTP error
* backported commit 55a77e8094994cd5bb970b38b6a2bd394346ec36
This commit is contained in:
parent
512e670de9
commit
fa1d056316
@ -581,6 +581,8 @@ bool GUIEngine::downloadFile(const std::string &url, const std::string &target)
|
||||
httpfetch_sync(fetch_request, fetch_result);
|
||||
|
||||
if (!fetch_result.succeeded) {
|
||||
target_file.close();
|
||||
fs::DeleteSingleFileOrEmptyDirectory(target);
|
||||
return false;
|
||||
}
|
||||
target_file << fetch_result.data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user