Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions wordpress/theme/includes/graphql/resolve-uris.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public function graphql_resolve_relative_uris($result, $source, $args, $context,
$site_url = preg_replace('/https?:\/\//', '', get_site_url());
$next_url = preg_replace('/https?:\/\//', '', get_next_url());

// Escape the hosts: they can contain slashes (e.g. sub-path installs like
// "localhost/subsite"), which would otherwise be read as the regex delimiter.
$site_url = preg_quote($site_url, '/');
$next_url = preg_quote($next_url, '/');

// Do not continue if the result is not a BE nor a FE url
if (! preg_match("/^https?:\/\/($site_url|$next_url)/i", $result)) return $result;

Expand Down