Unable to create h5p-content node (infinite copying in file system)

Created on 18 January 2023, over 1 year ago

Problem/Motivation

I tried to create a new H5P content using the "Multiple Choice" element. Saving
the node did not work as the server reached its maximum execution time.

Checking the file system after trying to save the node, showed that the
files/h5p/content directory had grown significantly. I found out, that the
module copied one directory into itself endlessly. E.g. it would copy
h5p/content/1234 to h5p/content/1234/1234 to h5p/content/1234/1234/1234 until
the maximum execution time is reached (or the file system is full).

Looking through the code, I found that the behaviour was caused by
cloneContent() (in h5p-default-storage.class.php line 86). The
first argument $id was empty, thus invoking
self::copyFileTree($path . $id, $path . $newId);
with "h5p/content/" and "h5p/content/1234".

The $id argument was empty, because in h5p_update() in line 637 of
h5p.module
$h5p_storage->copyPackage($node->vid, $node->old_vid, $node->nid)
was invoked, but $node->old_vid was empty.

Steps to reproduce

I was able to reproduce the issue by creating a new node of type h5p-content
and selecting any H5P content type that had been loaded via the hub.

Proposed resolution

I was able to prevent the issue by checking in
H5PDefaultStorage::cloneContent() if the passed $id is empty or not.

πŸ› Bug report
Status

Active

Version

1.51

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany lukas_w

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

Comments & Activities

Not all content is available!

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

No activities found.

Production build 0.69.0 2024