Skip to content

Commit

Permalink
apply_load: return "0" instead of the array for asynchronous request
Browse files Browse the repository at this point in the history
Fixes: 2f286f9
Bug: #16
  • Loading branch information
jesec committed Apr 30, 2021
1 parent a73dcfb commit 45d6e3c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/core/manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,20 +532,23 @@ Manager::try_create_download_expand(const std::string& uri,

if (flags & create_raw_data) {
result.push_back(try_create_download(uri, flags, commands));
return rawResult;
}

std::vector<std::string> paths;
paths.reserve(256);
} else {
std::vector<std::string> paths;

path_expand(&paths, uri);
path_expand(&paths, uri);

if (!paths.empty()) {
for (const auto& path : paths) {
result.push_back(try_create_download(path, flags, commands));
if (!paths.empty()) {
for (const auto& path : paths) {
result.push_back(try_create_download(path, flags, commands));
}
} else {
result.push_back(try_create_download(uri, flags, commands));
}
} else {
result.push_back(try_create_download(uri, flags, commands));
}

if (result.size() == 0 || result[0].type() != torrent::Object::TYPE_STRING) {
// return "0" instead of the array if the request is asynchronous
return torrent::Object();
}

return rawResult;
Expand Down

0 comments on commit 45d6e3c

Please sign in to comment.