[API] Fixed the properties for save downloadable files in products endpoint #5942

This commit is contained in:
Claudio Sanches 2015-01-22 19:20:05 -02:00
parent 3561c63ec1
commit 78fe840499
1 changed files with 6 additions and 2 deletions

View File

@ -1492,12 +1492,16 @@ class WC_API_Products extends WC_API_Resource {
// File paths will be stored in an array keyed off md5(file path) // File paths will be stored in an array keyed off md5(file path)
foreach ( $downloads as $key => $file ) { foreach ( $downloads as $key => $file ) {
if ( ! isset( $file['url'] ) ) { if ( isset( $file['url'] ) ) {
$file['file'] = $file['url'];
}
if ( ! isset( $file['file'] ) ) {
continue; continue;
} }
$file_name = isset( $file['name'] ) ? wc_clean( $file['name'] ) : ''; $file_name = isset( $file['name'] ) ? wc_clean( $file['name'] ) : '';
$file_url = wc_clean( $file['url'] ); $file_url = wc_clean( $file['file'] );
$files[ md5( $file_url ) ] = array( $files[ md5( $file_url ) ] = array(
'name' => $file_name, 'name' => $file_name,