fix: visual report drops photos whose URL slug contains icon or logo (#1685)
This commit is contained in:
@@ -1663,6 +1663,20 @@ def _extract_report_title(markdown_text: str, fallback: str):
|
||||
return fallback, markdown_text
|
||||
|
||||
|
||||
_ICON_LOGO_RE = re.compile(r'/(icon|logo|favicon)([._/-]|$)', re.IGNORECASE)
|
||||
|
||||
|
||||
def _is_icon_or_logo_url(url: str) -> bool:
|
||||
"""True if a URL path points at an icon/logo/favicon asset.
|
||||
|
||||
Matches the icon/logo/favicon token only at a path-segment or basename
|
||||
boundary, so a real photo whose slug merely CONTAINS the word (e.g.
|
||||
/iconic-moment.jpg, /logos-history.png) is no longer dropped, while
|
||||
/icon.png, /logo.svg and /favicon.ico still are.
|
||||
"""
|
||||
return bool(_ICON_LOGO_RE.search(url or ""))
|
||||
|
||||
|
||||
def generate_visual_report(
|
||||
question: str,
|
||||
report_markdown: str,
|
||||
@@ -1711,9 +1725,7 @@ def generate_visual_report(
|
||||
and img not in hidden_images_set
|
||||
and not img.endswith((".svg", ".ico", ".gif"))
|
||||
and not any(b in img for b in _IMAGE_BLOCKLIST)
|
||||
and "/icon" not in img.lower()
|
||||
and "/logo" not in img.lower()
|
||||
and "/favicon" not in img.lower()):
|
||||
and not _is_icon_or_logo_url(img)):
|
||||
_seen_images.add(img)
|
||||
all_images.append(img)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user