Unlink temporary file if sideload fails. see #7220
git-svn-id: https://develop.svn.wordpress.org/trunk@8241 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
713216192b
commit
410403c076
|
@ -340,10 +340,8 @@ function media_sideload_image($file, $post_id, $desc = null) {
|
||||||
$id = media_handle_sideload($file_array, $post_id, $desc);
|
$id = media_handle_sideload($file_array, $post_id, $desc);
|
||||||
$src = $id;
|
$src = $id;
|
||||||
|
|
||||||
unset($file_array);
|
|
||||||
|
|
||||||
if ( is_wp_error($id) ) {
|
if ( is_wp_error($id) ) {
|
||||||
$errors['upload_error'] = $id;
|
@unlink($file_array['tmp_name']);
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue