Skip to content

Commit

Permalink
When indexing for getIcon, check that the returned image is an in…
Browse files Browse the repository at this point in the history
…stance of `plone.namedfile.interfaces.IImage`. fixes gh-3916
  • Loading branch information
frapell committed Mar 5, 2024
1 parent 6813a99 commit aee7c4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Products/CMFPlone/CatalogTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from plone.i18n.normalizer.base import mapUnicode
from plone.indexer import indexer
from plone.indexer.interfaces import IIndexableObject
from plone.namedfile.interfaces import IImage
from Products.CMFCore.CatalogTool import _mergedLocalRoles
from Products.CMFCore.CatalogTool import CatalogTool as BaseTool
from Products.CMFCore.indexing import processQueue
Expand Down Expand Up @@ -234,7 +235,8 @@ def getIcon(obj):
when obj is an image or has a lead image
or has an image field with name 'image': true else false
"""
return bool(getattr(obj.aq_base, "image", False))
img_field = getattr(obj.aq_base, "image", False)
return bool(IImage.providedBy(img_field))


@indexer(Interface)
Expand Down

0 comments on commit aee7c4f

Please sign in to comment.