Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44864 closed defect (bug) (fixed)

4.9.8 breaks REST API attachment uploads on Multisite

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

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 6 years ago.
Require wp-admin/includes/ms.php

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 4.9.9
  • Summary changed from 4.9.8 breaks REST AI attachment uploads on Multisite to 4.9.8 breaks REST API attachment uploads on Multisite

#2 @mukesh27
6 years ago

  • Keywords needs-patch added

#3 @rachelbaker
6 years ago

  • Owner set to rachelbaker
  • Status changed from new to assigned

@rachelbaker
6 years ago

Require wp-admin/includes/ms.php

#4 @rachelbaker
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to 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
6 years ago

The patch works for me and resolves the issue.

#6 @pento
6 years ago

  • Keywords has-patch commit added; needs-patch removed
  • Milestone changed from 4.9.9 to 5.0
  • Resolution fixed deleted
  • Status changed from closed to reopened

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

#7 @danielbachhuber
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to 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.