H5P core: Prevent crash if H5P Integration does not provide file icon

Description

Acceptance criteria

If the H5P integration does not set H5PIntegration.editor.fileIcon properly, the editor does not crash.

Background

H5P core requires the H5P integration to specify a “binary” file icon and set it properly in H5PIntegration.editor.fileIcon. If the H5P integration does not do that (e.g. the H5P CLI server currently), and the author tries to upload some “binary” file, e.g. a VTT file as a track in H5P.Video, the editor crashes in https://github.com/h5p/h5p-editor-php-library/blob/master/scripts/h5peditor-file.js#L264.

See e.g. https://github.com/h5p/h5p-wordpress-plugin/blob/0510e44b2ee55f70042a2532d04ddd45d8a6d249/admin/class-h5p-content-admin.php#L1035-L1039 for the proper structure of the fileIcon property that an H5P integration is supposed to set.

Suggestion

Merge to add a fallback (the image that all H5P integrations use anyway).

Acceptance Criteria

None

Activity

Oliver Tacke April 22, 2024 at 1:22 PM

Up to you. This was not just a request for the H5P CLI tool only though. Other H5P integrations may miss this as well, so having this change in H5P core will make the core more robust.

Andrei Busuioc April 22, 2024 at 12:43 PM

The binary file is now provided by the h5p cli via .
Unless there are other scenarios where the binary file is missing I think we can close this.

Details

Assignee

Reporter

Priority

Created February 14, 2024 at 11:13 AM
Updated April 22, 2024 at 1:22 PM