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 git-svn-id: https://develop.svn.wordpress.org/trunk@37598 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
37704c5cb8
commit
dd472b7d2e
@ -493,7 +493,9 @@ function download_url( $url, $timeout = 300 ) {
|
||||
if ( ! $url )
|
||||
return new WP_Error('http_no_url', __('Invalid URL Provided.'));
|
||||
|
||||
$tmpfname = wp_tempnam($url);
|
||||
$url_filename = basename( parse_url( $url, PHP_URL_PATH ) );
|
||||
|
||||
$tmpfname = wp_tempnam( $url_filename );
|
||||
if ( ! $tmpfname )
|
||||
return new WP_Error('http_no_file', __('Could not create Temporary file.'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user