WordPress.org

Make WordPress Core

Changeset 37598


Ignore:
Timestamp:
05/31/2016 02:20:58 AM (4 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r37537 r37598  
    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.'));
Note: See TracChangeset for help on using the changeset viewer.