diff --git a/inc/class-tachyon.php b/inc/class-tachyon.php index 34ee767..00a107e 100644 --- a/inc/class-tachyon.php +++ b/inc/class-tachyon.php @@ -848,7 +848,7 @@ public function filter_srcset_array( $sources, $size_array, $image_src, $image_m public static function validate_image_url( $url ) { $parsed_url = @parse_url( $url ); - if ( ! $parsed_url ) { + if ( ! isset( $parsed_url['path'] ) ) { return false; } diff --git a/tests/tests/class-tests-linking.php b/tests/tests/class-tests-linking.php index 5ae316e..b340c7d 100644 --- a/tests/tests/class-tests-linking.php +++ b/tests/tests/class-tests-linking.php @@ -168,6 +168,13 @@ function data_content_filtering() { 'http://tachy.on/u/tachyon.jpg?resize=150%2C150', ], ], + // An image can link to a homepage with no URL path. + 'pathless image link' => [ + 'tachyon', + '
', + 'https://example.org', + 'http://tachy.on/u/tachyon.jpg?resize=150%2C150', + ], // Block editor linked thumbnail. [ 'tachyon',