Merge pull request #14070 from woocommerce/fix/13946-2
Dont throw exceptions when reading in saved bad downloads
This commit is contained in:
commit
7d37d858b4
|
@ -1155,13 +1155,17 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
|||
|
||||
// Validate the file extension
|
||||
if ( ! $download_object->is_allowed_filetype() ) {
|
||||
if ( $this->get_object_read() ) {
|
||||
$errors[] = sprintf( __( 'The downloadable file %1$s cannot be used as it does not have an allowed file type. Allowed types include: %2$s', 'woocommerce' ), '<code>' . basename( $download_object->get_file() ) . '</code>', '<code>' . implode( ', ', array_keys( $download_object->get_allowed_mime_types() ) ) . '</code>' );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validate the file exists.
|
||||
if ( ! $download_object->file_exists() ) {
|
||||
if ( $this->get_object_read() ) {
|
||||
$errors[] = sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $download_object->get_file() . '</code>' );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue