Skip to content

Conversation

@CySSoO
Copy link
Contributor

@CySSoO CySSoO commented Jan 9, 2026

Motivation

  • The webp conversion attempted remote downloads for same-host images due to an incorrect domain comparison, which produced HTTP failures and console errors.
  • Using raw file_get_contents produced PHP warnings when remote fetches failed during image downloads.
  • Resolving same-host URLs to local file paths avoids unnecessary network requests and potential service errors.
  • Using the framework helper for fetching improves error handling and suppresses noisy warnings.

Description

  • Extract the current host with parse_url(Tools::getHttpHost(true), PHP_URL_HOST) and fall back to Tools::getHttpHost(false) when necessary.
  • Update the host comparison in urlToFilePath to compare parsedUrl['host'] against the extracted currentHost so same-host URLs are treated as local.
  • Replace file_get_contents($url) with Tools::file_get_contents($url) in downloadImage to use the framework’s safer fetch helper.
  • Ensure urlToFilePath returns a local filesystem path for same-host images and downloadImage returns false on download failure.

Testing

  • No automated tests were run.

Codex Task

@CySSoO CySSoO merged commit a828496 into master Jan 9, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants