Errors on h5p library language files validation

Created on 8 July 2024, 4 months ago

Problem/Motivation

The function getLibraryData() in /vendor/h5p/h5p-core/h5p.classes.php does validation of a library languages files.
During the validation a language filename being analyzed like :

if (preg_match('/^(-?[a-z]+){1,7}\.json$/i', $languageFile) === 0) {
  $this->h5pF->setErrorMessage($this->h5pF->t('Invalid language file %file in library %library', array('%file' => $languageFile, '%library' => $file)), 'invalid-language-file');
  return FALSE;
}

This means only *.json files will be allowed, otherwise we will have an error message.
Some libraries contain *.gz language files in addition to *.json language files and we have error warnings when use getLibraryData() function.

Proposed resolution

Similar to filenames "." and ".." we should allow *.json.gz files as well and not return an error.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇦Ukraine yuriy.korzhov

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

Comments & Activities

Production build 0.71.5 2024