WordPress.org

Make WordPress Core

Changeset 10663


Ignore:
Timestamp:
02/27/2009 06:37:02 PM (9 years ago)
Author:
westi
Message:

Ensure that updating an uploaded file using AtomPub works correct. Fixes #9233 for trunk props josephscott

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-app.php

    r10651 r10663  
    2626/** Feed Handling API */
    2727require_once(ABSPATH . WPINC . '/feed.php');
     28
     29/** Admin Image API for metadata updating */
     30require_once(ABSPATH . '/wp-admin/includes/image.php');
    2831
    2932$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
     
    815818        }
    816819
     820        $upload_dir = wp_upload_dir( );
    817821        $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
    818822        $filetype = wp_check_filetype($location);
     823
     824        $location = "{$upload_dir['basedir']}/{$location}";
    819825
    820826        if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
     
    843849            $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
    844850        }
     851
     852        wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
    845853
    846854        log_app('function',"put_file($postID)");
Note: See TracChangeset for help on using the changeset viewer.