Merge pull request #3526 from dpalou/MOBILE-4235
MOBILE-4235 h5p: Fix regex applied by dependenciesmain
commit
f6e1b2deb2
|
@ -271,8 +271,13 @@ export class CoreH5PCore {
|
|||
if (addon.addTo?.content?.types?.length) {
|
||||
for (let i = 0; i < addon.addTo.content.types.length; i++) {
|
||||
const type = addon.addTo.content.types[i];
|
||||
let regex = type?.text?.regex;
|
||||
if (regex && regex[0] === '/' && regex.slice(-1) === '/') {
|
||||
// Regex designed for PHP. Remove the starting and ending slashes to convert them to JS format.
|
||||
regex = regex.substring(1, regex.length - 1);
|
||||
}
|
||||
|
||||
if (type && type.text && type.text.regex && this.textAddonMatches(params.params, type.text.regex)) {
|
||||
if (regex && this.textAddonMatches(params.params, regex)) {
|
||||
await validator.addon(addon);
|
||||
|
||||
// An addon shall only be added once.
|
||||
|
|
Loading…
Reference in New Issue