[2.3] Fixed download URL for relative paths, closes #8503
This commit is contained in:
parent
ffd63efbe2
commit
e888294caa
|
@ -1281,9 +1281,13 @@ class WC_Meta_Box_Product_Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the file exists
|
// Validate the file exists
|
||||||
if ( 'relative' === $file_is && ! apply_filters( 'woocommerce_downloadable_file_exists', file_exists( $file_url ), $file_url ) ) {
|
if ( 'relative' === $file_is ) {
|
||||||
WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $file_url . '</code>' ) );
|
$_file_exists = '..' === substr( $file_url, 0, 2 ) ? file_exists( realpath( ABSPATH . $file_url ) ) : file_exists( $file_url );
|
||||||
continue;
|
|
||||||
|
if ( ! apply_filters( 'woocommerce_downloadable_file_exists', $_file_exists, $file_url ) ) {
|
||||||
|
WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $file_url . '</code>' ) );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$files[ $file_hash ] = array(
|
$files[ $file_hash ] = array(
|
||||||
|
|
Loading…
Reference in New Issue