Index: tests/phpunit/tests/rest-api/rest-attachments-controller.php
===================================================================
--- tests/phpunit/tests/rest-api/rest-attachments-controller.php	(revision 39544)
+++ tests/phpunit/tests/rest-api/rest-attachments-controller.php	(working copy)
@@ -1143,6 +1143,26 @@
 		$wp_rest_additional_fields = array();
 	}
 
+	public function test_search_item_by_filename() {
+		$this->factory->attachment->create_object( $this->test_file, 0, array(
+			'post_mime_type' => 'image/jpeg',
+		) );
+		$this->factory->attachment->create_object( $this->test_file2, 0, array(
+			'post_mime_type' => 'image/png',
+		) );
+
+		$filename = basename( $this->test_file2 );
+
+		$request = new WP_REST_Request( 'GET', '/wp/v2/media' );
+		$request->set_param( 'search', $filename );
+		$response = $this->server->dispatch( $request );
+		$data = $response->get_data();
+
+		$this->assertCount( 1, $data );
+		$this->assertArrayHasKey( 0, $data );
+		$this->assertEquals( 'image/png', $data[0]['mime_type'] );
+	}
+
 	public function additional_field_get_callback( $object, $request ) {
 		return 123;
 	}
