Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enable the APP attachment file download to work correctly rather than…

… just returning a lot of php notices. Fixes #10372 for 2.8 branch props mysz.

git-svn-id: http://svn.automattic.com/wordpress/branches/2.8@11811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
commit 1ce7e21152837a294dadad8854af9deff1d88209 1 parent fbe5e94
westi authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 wp-app.php
View
17 wp-app.php
@@ -780,6 +780,7 @@ function get_file($postID) {
}
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
+ $location = get_option ('upload_path') . '/' . $location;
$filetype = wp_check_filetype($location);
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
@@ -789,11 +790,19 @@ function get_file($postID) {
header('Content-Type: ' . $entry['post_mime_type']);
header('Connection: close');
- $fp = fopen($location, "rb");
- while(!feof($fp)) {
- echo fread($fp, 4096);
+ if ($fp = fopen($location, "rb")) {
+ status_header('200');
+ header('Content-Type: ' . $entry['post_mime_type']);
+ header('Connection: close');
+
+ while(!feof($fp)) {
+ echo fread($fp, 4096);
+ }
+
+ fclose($fp);
+ } else {
+ status_header ('404');
}
- fclose($fp);
log_app('function',"get_file($postID)");
exit;
Please sign in to comment.
Something went wrong with that request. Please try again.