Skip to content

Fix website og:image using a data URI image joined to site-url - #15073

Merged
cderv merged 3 commits into
mainfrom
fix/issue-15055
Oct 15, 2026
Merged

cderv merged 3 commits into
mainfrom
fix/issue-15055

Conversation

@cderv

@cderv cderv commented Oct 15, 2026

Copy link
Copy Markdown
Member

When a website page sets no image, og:image and twitter:image can end up as a data URI joined to site-url, like https://example.com/data:image/png;base64,.... The ORCID badge rendered in the title block for an author with an orcid is the common trigger. Since #15050 reads the size of any image path, the same page now fails to render on main with a stat error on the data URI. The crash is not in a release, the wrong URL is older.

Root cause

Two places treat a data URI as a file path:

  1. Preview image discovery in discover-meta.ts returns it. The check added in 2023 to not test data URIs against the named file regex returns them instead of skipping them, and the last resort pass only excludes http/https images.
  2. Image resolution (imageMetadata, projectRelativeHref) only special-cases absolute URLs, so a data URI is resolved as a project path and joined to site-url. Listing items using projectRelativeHref got /posts/data:... the same way.

Fix

Crawlers and feed readers fetch these images by URL, so a data URI can't be used there:

  • Discovery for social metadata skips data URIs and moves on to the next image of the page, then the site image. Every image marked .preview-image is now tried, not only the first one.
  • A data URI set explicitly as a page, site, listing item or feed image is ignored with a warning for social metadata and listing feeds, and the next candidate is used.
  • projectRelativeHref leaves data URIs as is. Listing cards are displayed by the browser, so they keep showing them.

Fixes #15055

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone, DeepWiki MCP
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

cderv added 3 commits October 15, 2026 13:34
When a website page sets no image, preview image discovery picked an
inline data URI, such as the ORCID badge Quarto renders for an author
with an orcid, and joined it to site-url. Since #15050 the image size
is read from any path, so the data URI is also passed to stat and the
render fails (os error 123 on Windows, os error 63 on macOS).

Crawlers and feed readers fetch these images by URL, so a data URI is
never usable there:

- Discovery for og:image and twitter:image skips data URIs and moves
  on to the next image of the page or the site image. The named file
  pass never returns them, which is what the check added in 2023
  ("Don't attempt to test data uris") meant to do.
- A data URI set explicitly as a page, site or listing item image is
  ignored with a warning for social metadata and listing feeds.
- projectRelativeHref leaves data URIs as is, so listing cards, which
  the browser displays, show them instead of a broken project path.

Fixes #15055
When the first .preview-image was a data URI, querySelector stopped
there, so a later marked image was never considered and social
metadata fell back to the first local image or the site image.

Also match the feed warning by its own text in the test: the looser
pattern matched the social metadata warning of the same file too.
A data URI listing feed image was ignored with a warning, but the
channel then had no image at all, while social metadata falls back to
the next candidate. The feed now does the same: a data URI feed,
listing page or site image is skipped for the next one, so a data URI
feed image with a site image set still gives the channel an image.

The smoke test now covers a data URI feed image and a data URI site
image, the latter in its own project since the site image is
project-wide. Without the site image check, that render fails with the
stat error from the original report.
@posit-snyk-bot

posit-snyk-bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit 902b926 into main Oct 15, 2026
51 checks passed
@cderv
cderv deleted the fix/issue-15055 branch October 15, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Website og:image and twitter:image use a data URI prefixed with site-url, ignoring website.image

2 participants