mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Don't perform excessively large queries (words with more than 80 symbols) to
mediawiki sites, they can't succeed anyway.
This commit is contained in:
parent
c6b9cc0434
commit
6ea73fdf85
|
@ -340,7 +340,14 @@ sptr< WordSearchRequest > MediaWikiDictionary::prefixMatch( wstring const & word
|
|||
unsigned long maxResults )
|
||||
throw( std::exception )
|
||||
{
|
||||
return new MediaWikiWordSearchRequest( word, url, netMgr );
|
||||
if ( word.size() > 80 )
|
||||
{
|
||||
// Don't make excessively large queries -- they're fruitless anyway
|
||||
|
||||
return new WordSearchRequestInstant();
|
||||
}
|
||||
else
|
||||
return new MediaWikiWordSearchRequest( word, url, netMgr );
|
||||
}
|
||||
|
||||
sptr< DataRequest > MediaWikiDictionary::getArticle( wstring const & word,
|
||||
|
@ -348,7 +355,14 @@ sptr< DataRequest > MediaWikiDictionary::getArticle( wstring const & word,
|
|||
wstring const & )
|
||||
throw( std::exception )
|
||||
{
|
||||
return new MediaWikiArticleRequest( word, alts, url, netMgr );
|
||||
if ( word.size() > 80 )
|
||||
{
|
||||
// Don't make excessively large queries -- they're fruitless anyway
|
||||
|
||||
return new DataRequestInstant( false );
|
||||
}
|
||||
else
|
||||
return new MediaWikiArticleRequest( word, alts, url, netMgr );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue