| @@ 2021-2023 (lines=3) @@ | ||
| 2018 | 'timeout' => 10 |
|
| 2019 | ) ); |
|
| 2020 | ||
| 2021 | if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { |
|
| 2022 | throw new WC_CLI_Exception( 'woocommerce_cli_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ) ); |
|
| 2023 | } |
|
| 2024 | ||
| 2025 | // Ensure we have a file name and type |
|
| 2026 | if ( ! $wp_filetype['type'] ) { |
|
| @@ 73-75 (lines=3) @@ | ||
| 70 | 'timeout' => 10 |
|
| 71 | ) ); |
|
| 72 | ||
| 73 | if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { |
|
| 74 | return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s.', 'woocommerce' ), $image_url ), array( 'status' => 400 ) ); |
|
| 75 | } |
|
| 76 | ||
| 77 | // Ensure we have a file name and type. |
|
| 78 | if ( ! $wp_filetype['type'] ) { |
|