Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/wp-includes/class-wp-http.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ public function request( $url, $args = array() ) {
if ( $parsed_args['stream'] ) {
if ( empty( $parsed_args['filename'] ) ) {
$parsed_args['filename'] = get_temp_dir() . basename( $url );

// If that file exists, fallback to a temporary file.
if ( file_exists( $parsed_args['filename'] ) ) {
$parsed_args['filename'] = wp_tempnam( basename( $url ) );
}
}

// Force some settings if we are streaming to a file and check for existence
Expand Down
Loading