Index: src/wp-includes/functions.php
===================================================================
--- src/wp-includes/functions.php	(revision 51904)
+++ src/wp-includes/functions.php	(working copy)
@@ -2927,8 +2927,9 @@
  * You can optionally define the mime array, if needed.
  *
  * @since 2.0.4
+ * @since x.x.x URLs are now supported.
  *
- * @param string   $filename File name or path.
+ * @param string   $filename File name, path, or URL.
  * @param string[] $mimes    Optional. Array of allowed mime types keyed by their file extension regex.
  * @return array {
  *     Values for the extension and mime type.
@@ -2944,6 +2945,15 @@
 	$type = false;
 	$ext  = false;
 
+	// Strip query args and fragment from filename to reveal extension.
+	$query_pos = strpos( $filename, '?' );
+
+	if ( false !== $query_pos ) {
+		$filename = substr_replace( $filename, '', $query_pos );
+	}
+
+	$filename = strip_fragment_from_url( $filename );
+
 	foreach ( $mimes as $ext_preg => $mime_match ) {
 		$ext_preg = '!\.(' . $ext_preg . ')$!i';
 		if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
Index: tests/phpunit/tests/functions/wpCheckFiletype.php
===================================================================
--- tests/phpunit/tests/functions/wpCheckFiletype.php	(nonexistent)
+++ tests/phpunit/tests/functions/wpCheckFiletype.php	(working copy)
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * Tests for wp_check_filetype()
+ *
+ * @group functions.php
+ * @covers ::wp_check_filetype
+ */
+class Tests_Functions_wpCheckFiletype extends WP_UnitTestCase {
+
+	public function data_url_filetypes() {
+		return array(
+			// Invalid or empty data:
+			array( null, false ),
+			array( '', false ),
+			array( ' ', false ),
+
+			// Paths:
+			array( 'file.jpg', 'jpg' ),
+			array( 'C:\path\to\file.mp3', 'mp3' ),
+			array( 'C:\path\to\file.mp3?file.jpg', 'mp3' ),
+			array( 'C:\path\to\file.exe?file.jpg', false ),
+			array( '/file.jpg', 'jpg' ),
+			array( '/path/to/file.jpg', 'jpg' ),
+			array( '/path/to/file.jpg', 'jpg' ),
+			array( '/file.exe?file.jpg', false ),
+
+			// Absolute URLs:
+			array( 'http://example.com', false ),
+			array( 'http://example.com/', false ),
+			array( 'http://example.com/wibble', false ),
+			array( 'http://example.com/wibble/', false ),
+			array( 'http://example.com/wibble.wobble', false ),
+			array( 'http://example.com/wibble.mp3', 'mp3' ),
+			array( 'http://example.com/wibble.mp3#wobble', 'mp3' ),
+			array( 'http://example.com/wibble.mp3?wobble=true', 'mp3' ),
+			array( 'http://example.com/wibble.mp3?wobble=true#wobble', 'mp3' ),
+			array( 'http://example.mp3', false ),
+			array( 'http://example.mp3/', false ),
+			array( 'http://example.com/file.mp3#file.jpg', 'mp3' ),
+			array( 'http://example.com/file.mp3?file.jpg', 'mp3' ),
+			array( 'http://example.com/file.exe#file.jpg', false ),
+			array( 'http://example.com/file.exe?file.jpg', false ),
+			array( 'http://example.com/file.mp3?foo=bar#?file=file.jpg', 'mp3' ),
+			array( 'http://example.com?file.jpg', false ),
+		);
+	}
+
+	/**
+	 * @dataProvider data_url_filetypes
+	 *
+	 * @param string       $url
+	 * @param string|false $expected
+	 */
+	public function test_url_ext( $url, $expected ) {
+		$filetype = wp_check_filetype( $url );
+		$this->assertSame( $expected, $filetype['ext'] );
+	}
+}

Property changes on: tests/phpunit/tests/functions/wpCheckFiletype.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
