From 4e9c69747bfb6d0d97835c0e8d695daa815f5403 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Tue, 26 Jun 2007 20:45:30 +0000 Subject: [PATCH] Check post type after upload. Props Alexander Concha git-svn-id: http://svn.automattic.com/wordpress/trunk@5765 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-app.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-app.php b/wp-app.php index c0b023780..57804aa24 100644 --- a/wp-app.php +++ b/wp-app.php @@ -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");