From 2a9b332a69b8ef58cba3ce6e0d44f1544e07404c Mon Sep 17 00:00:00 2001 From: Anukasha Singh Date: Thu, 9 Apr 2026 14:05:59 +0530 Subject: [PATCH] fixing no extension urls --- src/wp-includes/media.php | 32 ++++++++++++++++++---------- tests/phpunit/tests/media.php | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 8f6ec1cef4e26..8ed4dfd11e1ab 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -3468,9 +3468,10 @@ function wp_audio_shortcode( $attr, $content = '' ) { $primary = false; if ( ! empty( $atts['src'] ) ) { - $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); + $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); + $has_extension = (bool) pathinfo( wp_parse_url( $atts['src'], PHP_URL_PATH ), PATHINFO_EXTENSION ); - if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) { + if ( $has_extension && ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) { return sprintf( '%s', esc_url( $atts['src'] ), esc_html( $atts['src'] ) ); } @@ -3567,7 +3568,6 @@ function wp_audio_shortcode( $attr, $content = '' ) { $html = sprintf( '