diff --git tests/phpunit/tests/admin/includesFile.php tests/phpunit/tests/admin/includesFile.php
index a3af5da2d1..4818a09be1 100644
--- tests/phpunit/tests/admin/includesFile.php
+++ tests/phpunit/tests/admin/includesFile.php
@@ -77,4 +77,48 @@ class Tests_Admin_includesFile extends WP_UnitTestCase {
 	public function __return_5() {
 		return 5;
 	}
+
+	/**
+	 * @ticket 38231
+	 * @dataProvider provider_for_download_url_filename_from_content_disposition_header
+	 */
+	public function test_download_url_filename_from_content_disposition_header( $filter ) {
+		add_filter( 'pre_http_request', array( $this, $filter ), 10, 3 );
+
+		$filename = download_url( 'url_with_content_disposition_header' );
+		$this->assertContains( 'filename-from-content-disposition-header', $filename );
+		$this->assertFileExists( $filename );
+		$this->unlink( $filename );
+
+		remove_filter( 'pre_http_request', array( $this, $filter ) );
+	}
+
+	public function provider_for_download_url_filename_from_content_disposition_header() {
+		return array(
+			array( '_fake_download_url_with_content_disposition_header' ),
+			array( '_fake_download_url_with_content_disposition_header_without_quotes' ),
+		);
+	}
+
+	public function _fake_download_url_with_content_disposition_header( $response, $args, $url ) {
+		return array(
+			'response' => array(
+				'code' => 200,
+			),
+			'headers'  => array(
+				'Content-Disposition' => 'filename="filename-from-content-disposition-header.txt"',
+			),
+		);
+	}
+
+	public function _fake_download_url_with_content_disposition_header_without_quotes( $response, $args, $url ) {
+		return array(
+			'response' => array(
+				'code' => 200,
+			),
+			'headers'  => array(
+				'Content-Disposition' => 'filename=filename-from-content-disposition-header.txt',
+			),
+		);
+	}
 }
