Skip to content

Commit 2f8867d

Browse files
author
dd32
committed
Updates: Only use the filename component of URLs to form part of the temporary filename.
Previously we were passing the entire URL to `wp_tempnam()` (incorrectly) which caused the query string to be used as part of the temporary filename. We now only use the file component of a url such as `https://example.com/filename.zip?arg1=1&arg2=2....&arg100=100` to prevent a long filename. Fixes #34938 Built from https://develop.svn.wordpress.org/trunk@37598
1 parent a5bf986 commit 2f8867d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

wp-admin/includes/file.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,9 @@ function download_url( $url, $timeout = 300 ) {
493493
if ( ! $url )
494494
return new WP_Error('http_no_url', __('Invalid URL Provided.'));
495495

496-
$tmpfname = wp_tempnam($url);
496+
$url_filename = basename( parse_url( $url, PHP_URL_PATH ) );
497+
498+
$tmpfname = wp_tempnam( $url_filename );
497499
if ( ! $tmpfname )
498500
return new WP_Error('http_no_file', __('Could not create Temporary file.'));
499501

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '4.6-alpha-37597';
7+
$wp_version = '4.6-alpha-37598';
88

99
/**
1010
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)