Automattic / Automattic/jetpack

VideoPress: Dragging and dropping video into Cover block to upload throws errors

Open
#36,258 1 comment 0 reactions 0 assignees View on GitHub
[Feature] VideoPress [Plugin] Jetpack [Plugin] VideoPress [Pri] Low [Status] Stale Bug Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

VideoPress

### Quick summary

The Block editor lets you drag media like images and videos directly into certain blocks in the editor to upload them to the media library.

When you have VideoPress enabled on a site, and drag a video into the cover block in the editor, the video doesn't load and the browser throws an error.

### Steps to reproduce

1. Start on a self-hosted or Atomic site with Jetpack and VideoPress enabled.
2. Create a new page, and add a Cover block.
3. Drag a video from your computer into the Cover block to upload.

### A clear and concise description of what you expected to happen.

I expected the video to be uploaded to the media library, and preview in the editor.

### What actually happened

The video is not uploaded. Sometimes (but not always), an error (invalid JSON response or "you are probably offline") would display in the editor.

A couple errors also appear in the console:

```
post.php:1 Access to fetch at 'https://public-api.wordpress.com/rest/v1.1/sites/230270056/media/new?locale=en_US&_locale=user' from origin '[removed URL]' has been blocked by CORS policy: Request header field x-wp-api-fetch-from-editor is not allowed by Access-Control-Allow-Headers in preflight response.
```
and

```
POST https://public-api.wordpress.com/rest/v1.1/sites/230270056/media/new?locale=en_US&_locale=user net::ERR_FAILED
```

Uploading the video to the media library first works as expected.

### Impact

Some (< 50%)

### Available workarounds?

Yes, easy to implement

### Platform (Simple and/or Atomic)

_No response_

### Logs or notes

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the upload from a Cover block with Jetpack and VideoPress enabled, then inspect the browser console and the media upload request. Trace the CORS preflight and editor upload path described in the report; done means the video uploads to the media library, previews in the editor, and no invalid JSON, offline, or CORS errors appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
wordpress
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.