Check post type after upload. Props Alexander Concha

git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-06-26 20:47:17 +00:00
parent 856d4bb2a8
commit 7f0e860479
1 changed files with 4 additions and 2 deletions

View File

@ -673,8 +673,9 @@ EOD;
} }
$location = get_post_meta($entry['ID'], '_wp_attached_file', true); $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.')); $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
header('Content-Type: ' . $entry['post_mime_type']); header('Content-Type: ' . $entry['post_mime_type']);
@ -707,8 +708,9 @@ EOD;
} }
$location = get_post_meta($entry['ID'], '_wp_attached_file', true); $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.')); $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
$fp = fopen("php://input", "rb"); $fp = fopen("php://input", "rb");