Warning improvements when requesting bad URLs

Found while debugging some issues with add-default-catalog flow in
the launcher.
This commit is contained in:
James Turner
2018-05-08 06:50:15 +01:00
parent a232565b3e
commit f5ff969cd4
2 changed files with 11 additions and 1 deletions

View File

@@ -242,8 +242,13 @@ void Client::makeRequest(const Request_ptr& r)
if( r->isComplete() )
return;
if (r->url().empty()) {
r->setFailure(EINVAL, "no URL specified on request");
return;
}
if( r->url().find("://") == std::string::npos ) {
r->setFailure(EINVAL, "malformed URL");
r->setFailure(EINVAL, "malformed URL: '" + r->url() + "'");
return;
}

View File

@@ -778,6 +778,11 @@ bool Root::removeCatalogById(const std::string& aId)
void Root::requestThumbnailData(const std::string& aUrl)
{
if (aUrl.empty()) {
SG_LOG(SG_GENERAL, SG_DEV_WARN, "requestThumbnailData: empty URL requested");
return;
}
auto it = d->thumbnailCache.find(aUrl);
if (it == d->thumbnailCache.end()) {
bool cachedOnDisk = d->checkPersistentCache(aUrl);