mirror of
https://github.com/searxng/searxng.git
synced 2026-07-17 21:41:24 +00:00
[fix] public domain image archive: crashes upon response
The code used here has always been "bad" because `about` shouldn't be used as data source, but the engine probably broke when type checks / dataclasses for the about parameter in engines has been added with <https://github.com/searxng/searxng/pull/6258>. Error log: ``` WARNING searx.engines.public domain im: ErrorContext('searx/engines/public_domain_image_archive.py', 143, '\'url\': _clean_url(f"{about[\'website\']}/images/{result[\'objectID\']}"),', 'TypeError', None, ("'EngineAbout' object is not subscriptable",)) False ERROR searx.engines.public domain im: exception : 'EngineAbout' object is not subscriptable Traceback (most recent call last): File "/home/bnyro/Projects/searxng/searx/search/processors/online.py", line 253, in search search_results = self._search_basic(query, params) File "/home/bnyro/Projects/searxng/searx/search/processors/online.py", line 239, in _search_basic return self.engine.response(response) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/home/bnyro/Projects/searxng/searx/engines/public_domain_image_archive.py", line 143, in response 'url': _clean_url(f"{about['website']}/images/{result['objectID']}"), ~~~~~^^^^^^^^^^^ TypeError: 'EngineAbout' object is not subscriptable ```
This commit is contained in:
@@ -140,7 +140,7 @@ def response(resp):
|
||||
results.append(
|
||||
{
|
||||
'template': 'images.html',
|
||||
'url': _clean_url(f"{about['website']}/images/{result['objectID']}"),
|
||||
'url': _clean_url(f"{pdia_base_url}/images/{result['objectID']}"),
|
||||
'img_src': _clean_url(base_image_url),
|
||||
'thumbnail_src': _clean_url(base_image_url + THUMBNAIL_SUFFIX),
|
||||
'title': f"{result['title'].strip()} by {result['artist']} {result.get('displayYear', '')}",
|
||||
|
||||
Reference in New Issue
Block a user