diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index cbafdd4c473..803a21b6763 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -1603,7 +1603,7 @@ class WC_API_Products extends WC_API_Resource { } $file_name = isset( $file['name'] ) ? wc_clean( $file['name'] ) : ''; - $file_url = wc_clean( $file['file'] ); + $file_url = esc_url_raw( $file['file'] ); $files[ md5( $file_url ) ] = array( 'name' => $file_name, @@ -1734,7 +1734,7 @@ class WC_API_Products extends WC_API_Resource { $attachment_id = isset( $image['id'] ) ? absint( $image['id'] ) : 0; if ( 0 === $attachment_id && isset( $image['src'] ) ) { - $upload = $this->upload_product_image( wc_clean( $image['src'] ) ); + $upload = $this->upload_product_image( esc_url_raw( $image['src'] ) ); if ( is_wp_error( $upload ) ) { throw new WC_API_Exception( 'woocommerce_api_cannot_upload_product_image', $upload->get_error_message(), 400 ); @@ -1748,7 +1748,7 @@ class WC_API_Products extends WC_API_Resource { $attachment_id = isset( $image['id'] ) ? absint( $image['id'] ) : 0; if ( 0 === $attachment_id && isset( $image['src'] ) ) { - $upload = $this->upload_product_image( wc_clean( $image['src'] ) ); + $upload = $this->upload_product_image( esc_url_raw( $image['src'] ) ); if ( is_wp_error( $upload ) ) { throw new WC_API_Exception( 'woocommerce_api_cannot_upload_product_image', $upload->get_error_message(), 400 );