diff --git a/feed-parsers/class-feed-parser.php b/feed-parsers/class-feed-parser.php index 2c740588..fe13b5ed 100644 --- a/feed-parsers/class-feed-parser.php +++ b/feed-parsers/class-feed-parser.php @@ -94,16 +94,21 @@ public function convert_relative_urls_to_absolute_urls( $html, $permalink ) { return preg_replace_callback( '~(src|href)=(?:"([^"]+)|\'([^\']+))~i', function ( $m ) use ( $permalink ) { + // Don't update hash-only links. if ( str_starts_with( $m[2], '#' ) ) { - // Don't update hash-only links. return $m[0]; } + // Remove absolute URL from hashes so that it can become relative. if ( str_starts_with( $m[2], $permalink . '#' ) ) { - // Remove absolute URL from hashes. return str_replace( $permalink, '', $m[0] ); } + // Don't convert content URLs like data:image/png;base64, etc. + if ( str_starts_with( $m[2], 'data:' ) ) { + return $m[0]; + } + // Convert relative URLs to absolute ones. return str_replace( $m[2], Mf2\resolveUrl( $permalink, $m[2] ), $m[0] ); },