This commit is contained in:
Sude 2023-05-29 06:23:07 +03:00
commit 417570cd1e
2 changed files with 12 additions and 2 deletions

View File

@ -4023,7 +4023,7 @@ void Downloader::processGalaxyDownloadQueue(const std::string& install_path, Con
if (filesize == item.totalSizeUncompressed) if (filesize == item.totalSizeUncompressed)
{ {
// File is same size // File is same size
if (Util::getFileHash(path.string(), RHASH_MD5) == item.md5) if (item.totalSizeUncompressed == 0 || Util::getFileHash(path.string(), RHASH_MD5) == item.md5)
{ {
msgQueue.push(Message(path.string() + ": OK", MSGTYPE_SUCCESS, msg_prefix, MSGLEVEL_DEFAULT)); msgQueue.push(Message(path.string() + ": OK", MSGTYPE_SUCCESS, msg_prefix, MSGLEVEL_DEFAULT));
continue; continue;
@ -4125,6 +4125,14 @@ void Downloader::processGalaxyDownloadQueue(const std::string& install_path, Con
bool bChunkFailure = false; bool bChunkFailure = false;
std::time_t timestamp = -1; std::time_t timestamp = -1;
// Handle empty files
if (item.chunks.empty())
{
// Create empty file
std::ofstream ofs(path.string(), std::ofstream::out | std::ofstream::binary);
if (ofs)
ofs.close();
}
for (unsigned int j = start_chunk; j < item.chunks.size(); ++j) for (unsigned int j = start_chunk; j < item.chunks.size(); ++j)
{ {
// Refresh Galaxy login if token is expired // Refresh Galaxy login if token is expired

View File

@ -258,7 +258,7 @@ std::vector<galaxyDepotItem> galaxyAPI::getDepotItemsVector(const std::string& h
for (unsigned int i = 0; i < json["depot"]["items"].size(); ++i) for (unsigned int i = 0; i < json["depot"]["items"].size(); ++i)
{ {
if (!json["depot"]["items"][i]["chunks"].empty()) if (json["depot"]["items"][i]["chunks"].isArray())
{ {
galaxyDepotItem item; galaxyDepotItem item;
item.totalSizeCompressed = 0; item.totalSizeCompressed = 0;
@ -287,6 +287,8 @@ std::vector<galaxyDepotItem> galaxyAPI::getDepotItemsVector(const std::string& h
item.md5 = json["depot"]["items"][i]["md5"].asString(); item.md5 = json["depot"]["items"][i]["md5"].asString();
else if (json["depot"]["items"][i]["chunks"].size() == 1) else if (json["depot"]["items"][i]["chunks"].size() == 1)
item.md5 = json["depot"]["items"][i]["chunks"][0]["md5"].asString(); item.md5 = json["depot"]["items"][i]["chunks"][0]["md5"].asString();
else
item.md5 = std::string();
items.push_back(item); items.push_back(item);
} }