Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#44864 closed defect (bug) (fixed)

4.9.8 breaks REST API attachment uploads on Multisite

Reported by: JakePT Owned by: rachelbaker
Priority: normal Milestone: 5.0
Component: REST API Version: 4.9.8
Severity: critical Keywords: has-patch commit
Cc: Focuses: rest-api

Description

[43462] seems to have broken attachment uploads over the REST API in Multisite. This appears to be causing issues for people using Gutenberg:

​https://github.com/WordPress/gutenberg/issues/9134

​https://github.com/WordPress/gutenberg/issues/9142

When attempting to upload an image this error is occurring:

Call to undefined function upload_is_user_over_quota() in /PATH/TO/FOLDER/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:808

The new check_upload_size() method of WP_REST_Attachments_Controller uses the upload_is_user_over_quota() function, however this function is part of wp-admin/includes/ms.php which is only loaded in the admin and doesn't appear to be loaded on REST requests.

Attachments (1)

44864.diff​ (926 bytes ) - added by rachelbaker 8 years ago.
Require wp-admin/includes/ms.php

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
8 years ago

  • Milestone Awaiting Review → 4.9.9
  • Summary 4.9.8 breaks REST AI attachment uploads on Multisite → 4.9.8 breaks REST API attachment uploads on Multisite

#2 @mukesh27
8 years ago

  • Keywords needs-patch added

#3 @rachelbaker
8 years ago

  • Owner set to rachelbaker
  • Status new → assigned

@rachelbaker
8 years ago

Require wp-admin/includes/ms.php

#4 @rachelbaker
8 years ago

  • Resolution → fixed
  • Status assigned → closed

In 43603:

REST API: Load missing required file for multisite users in WP_REST_Attachments_Controller::check_upload_size().

Requires wp-admin/includes/ms.php to make upload_is_user_over_quota() function available to multisite users uploading files.

Props JakePT, rachelbaker.
Fixes #44864.

#5 @joachimschlosser
8 years ago

The patch works for me and resolves the issue.

#6 @pento
8 years ago

  • Keywords has-patch commit added; needs-patch removed
  • Milestone 4.9.9 → 5.0
  • Resolution fixed
  • Status closed → reopened

[43603] was never ported to the 4.9 branch, let's put it in the 5.0 branch.

#7 @danielbachhuber
8 years ago

  • Resolution → fixed
  • Status reopened → closed

In 43691:

REST API: Load missing required file for multisite users

Requires wp-admin/includes/ms.php to make upload_is_user_over_quota() function available to multisite users uploading files.

Props JakePT, rachelbaker.
Merges [43603] to the 5.0 branch.
Fixes #44864.

Note: See TracTickets for help on using tickets.