[drupalMedia] CKEditor 5 media preview fetch fails if there is a HUGE caption

Created on 9 October 2023, about 1 year ago
Updated 16 May 2024, 6 months ago

Problem/Motivation

  1. This seems like it's now resolved in D10:
  2. If an editor adds a very long alt or data-caption attribute to a <drupal-media> element for example by editing the source directly, the request fetching the preview can fail with a HTTP 414 because the entire <drupal-media> tag is sent as a query parameter to the server

Steps to reproduce

Issue described in point 2 above: On vanilla D10 10.2.x

  1. Install the media_library modules
  2. Enable the Embed media toolbar item and filter in the Basic HTML text format
  3. Create an article and edit it
  4. In the body field embed an image media entity. This patch Media Library: Argument #1 ($array) must be of type array, null given in array_filter(). Needs work was necessary for me locally in order fix the unrelated bug occurring when submitting the media library selection.
  5. Click the Switch to source editing mode and edit the <drupal-media> tag adding an altattribute with the same value as in the new test or a very long text (like 20'000 characters or more)
  6. Switch back to the normal editing mode

Expected result: The editor loads the added image
Actual result: The editor displays an error message An error occurred while trying to preview the media. Please save your work and reload this page.

Proposed resolution

Use a POST request instead of a GET request to fetch the media preview and send the text and uuid parameters in the body of the POST request.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
CKEditor 5 

Last updated about 15 hours ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • JavaScript

    Affects the content, performance, or handling of Javascript.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024