Check post type after upload. Props Alexander Concha

git-svn-id: https://develop.svn.wordpress.org/trunk@5765 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2007-06-26 20:45:30 +00:00
parent 94563d9f33
commit 402a228880

View File

@ -673,8 +673,9 @@ EOD;
}
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
$filetype = wp_check_filetype($location);
if(!isset($location))
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
$this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
header('Content-Type: ' . $entry['post_mime_type']);
@ -707,8 +708,9 @@ EOD;
}
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
$filetype = wp_check_filetype($location);
if(!isset($location))
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
$this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
$fp = fopen("php://input", "rb");