Update wc-rest-functions.php

Arguments passed to end function should be passed by reference.
This commit is contained in:
Jon Besga 2018-06-12 12:45:22 +01:00 committed by GitHub
parent ebcdd5fde3
commit e75c3716d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -102,7 +102,8 @@ function wc_rest_upload_image_from_url( $image_url ) {
if ( ! $wp_filetype['type'] ) {
$headers = wp_remote_retrieve_headers( $response );
if ( isset( $headers['content-disposition'] ) && strstr( $headers['content-disposition'], 'filename=' ) ) {
$disposition = end( explode( 'filename=', $headers['content-disposition'] ) );
$content = explode( 'filename=', $headers['content-disposition'] );
$disposition = end( $content );
$disposition = sanitize_file_name( $disposition );
$file_name = $disposition;
} elseif ( isset( $headers['content-type'] ) && strstr( $headers['content-type'], 'image/' ) ) {