Skip to content

Commit

Permalink
WPCOM_JSON_API_Upload_Media_v1_1_Endpoint: Be defensive about uploads…
Browse files Browse the repository at this point in the history
… without $media_item['type'] set (Automattic#36291)
  • Loading branch information
mreishus authored Mar 8, 2024
1 parent 0afaef0 commit 661a2dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/update-upload-media-wpcom
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

WPCOM_JSON_API_Upload_Media_v1_1_Endpoint: Fix errors on invalid post data
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function force_wpcom_request( $blog_id ) {
}

foreach ( $media_files as $media_item ) {
if ( ! preg_match( '@^video/@', $media_item['type'] ) ) {
if ( ! isset( $media_item['type'] ) || ! preg_match( '@^video/@', $media_item['type'] ) ) {
return false;
}
}
Expand Down

0 comments on commit 661a2dc

Please sign in to comment.