Files disappear in H5P editor

Created on 26 January 2021, over 4 years ago
Updated 6 August 2025, 6 days ago

Problem/Motivation

I use H5P elements within paragraphs ( https://www.drupal.org/project/paragraphs β†’ ). If I add a file (eg. an image) to a H5P-element, this file may disappear, if I again edit the node.

<!--break-->

Steps to reproduce

  1. Have a paragraph with a H5P field.
  2. Create a node with the H5P paragraph and in the H5P element upload an image (ie. choose an appropriate H5P type).
    1. With the developer tools of your browser, check the location of the uploaded image. It should be something like "/path/to/public/files/h5p/editor/images/image-1234567890abc.jpg".
  3. (Wait the time period after which Drupal removes temporary files.)
  4. Edit the node, that was created before.
    1. Check again the location of the image. It should be something like "/path/to/public/files/h5p/content/123/images/image-1234567890abc.jpg"
    2. Add another paragraph to the node. Now the H5P editor widgets for all H5P elements of the node are reloaded (either via AJAX or a full page load).
    3. Now the image should be missing. If we check the path of the image again, it should be like "/path/to/public/files/h5p/editor/images/image-1234567890abc.jpg" again. The image is missing, because it was removed from that location, when Drupal removed temporary files. The real path of the image is still like "/path/to/public/files/h5p/content/123/images/image-1234567890abc.jpg".
    4. Save the node and open it again for editing. Check the file's path. It should be "/path/to/public/files/h5p/content/123/images/image-1234567890abc.jpg" again, but the file is now missing in that location.

Proposed resolution

When the H5P editor widget gets reloaded, it should keep the path of the image and not change the image's path to the temporary one.

This seems to happen because the h5p_content_id of the H5P element is lost during the reload of the element. Therefore the element is treated as a new element and the path for new elements' files is used.

πŸ› Bug report
Status

RTBC

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany lukas_w

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024