Warning improvements when requesting bad URLs
Found while debugging some issues with add-default-catalog flow in the launcher.
This commit is contained in:
@@ -242,8 +242,13 @@ void Client::makeRequest(const Request_ptr& r)
|
|||||||
if( r->isComplete() )
|
if( r->isComplete() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (r->url().empty()) {
|
||||||
|
r->setFailure(EINVAL, "no URL specified on request");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( r->url().find("://") == std::string::npos ) {
|
if( r->url().find("://") == std::string::npos ) {
|
||||||
r->setFailure(EINVAL, "malformed URL");
|
r->setFailure(EINVAL, "malformed URL: '" + r->url() + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -778,6 +778,11 @@ bool Root::removeCatalogById(const std::string& aId)
|
|||||||
|
|
||||||
void Root::requestThumbnailData(const std::string& aUrl)
|
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);
|
auto it = d->thumbnailCache.find(aUrl);
|
||||||
if (it == d->thumbnailCache.end()) {
|
if (it == d->thumbnailCache.end()) {
|
||||||
bool cachedOnDisk = d->checkPersistentCache(aUrl);
|
bool cachedOnDisk = d->checkPersistentCache(aUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user