Skip to content

Handle pathless URLs in Tachyon image validation - #90

Open
willmot wants to merge 1 commit into
masterfrom
codex/tachyon-pathless-image-urls
Open

willmot wants to merge 1 commit into
masterfrom
codex/tachyon-pathless-image-urls

Conversation

@willmot

@willmot willmot commented Dec 1, 2026

Copy link
Copy Markdown
Member

Reproduce

  1. On a site with Tachyon enabled, insert a Custom HTML block containing the markup below. Replace the image source with a real upload from the site and keep href="https://example.org" without a trailing slash.
  2. Preview the post so WordPress renders the image.
  3. Check the PHP log. Tachyon emits Undefined array key "path" while checking the link.
<a href="https://example.org">
  <img src="https://site.test/wp-content/uploads/photo.jpg"
       width="150" height="150" alt="Example image">
</a>

Fix

Tachyon checks links around images because they may point to a full-size upload. PHP parses a hostname-only URL successfully and omits the path key. Check for that key before looking up the file extension. The image source can still be rewritten while the original link is preserved.

Testing

The new regression case reproduced the warning on the base revision. All four linking tests passed after the change on PHP 8.4 with eight assertions. The full local suite hit an existing Tests_Resizing::setUp() signature incompatibility with the shared PHPUnit 9 runner.

AI disclosure: Codex wrote the fix, reproduction steps, and regression case, ran the local checks, and opened this PR under Tom’s direction.

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.

1 participant