Make WordPress Core

Ticket #40343: 40343.diff

File 40343.diff, 1.1 KB (added by curdin, 8 years ago)

First proof-of-concept failed to work without time header.

  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    index 43d057e167..4c399e079e 100644
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    519519                // Get the content-type.
    520520                $type = array_shift( $headers['content_type'] );
    521521
     522                $time =  isset( $headers['time'] ) ? array_shift( $headers['time'] ) : false;
     523
    522524                /** Include admin functions to get access to wp_tempnam() and wp_handle_sideload() */
    523525                require_once ABSPATH . 'wp-admin/includes/admin.php';
    524526
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    546548                        'test_form' => false,
    547549                );
    548550
    549                 $sideloaded = wp_handle_sideload( $file_data, $overrides );
     551                $sideloaded = wp_handle_sideload( $file_data, $overrides, $time );
    550552
    551553                if ( isset( $sideloaded['error'] ) ) {
    552554                        @unlink( $tmpfname );