Invalid h5p.json file HELP

We have created some content on h5p.org as we wanted to keep it open. However we would like to transfer these to our Moodle site. rather than recreateing each resource, I downloaded the H5P file and tried to uploaded it to Moodle via the H5P upload option, but get the error message. The oldest file I tried was created 22 October, so it it more than 2 weeks, so don't think that is the issue. Any other suggestions or will I have to remake each resource?

thanks

Nick

Validating h5p package failed.

Invalid data provided for license in h5p.json

The main h5p.json file is not validGet help

A valid main h5p.json file is missingGet help

BV52's picture

Hi nickzog,

Please update H5P in your Moodle. This should allow you to upload the contents downloaded from H5P.org.

-BV52

My h5p plugin inside moodle is up to date with latest version but this error still persist.Any help will be appreciated.My moodle version is 3.10.8+.

My moodle version is Moodle 3.10.8+ (Build: 20211116) and h5p version is 1.22.4 and i am still getting the error while uploading the file.Any help will be appreciated and the h5p version ss is attached.

BV52's picture

Hi sagar456,

Where did you download this content from? I am suspecting that either the file is corrupted or the platform where this was downloaded have custom libraries.

-BV

otacke's picture

Hi all!

The problem is that the h5p.json file inside the content contains an attribute "source" set to the value "normal". That attribute exists, but it should be a URL, not a plain string like "normal". It violates the H5P specification, and therefore H5P core rejects to upload it.

That attribute is fueled by the metadata dialog, by the source attribute, obviously. The H5P editor would normally add the protocol ("http://") at the beginning of the text if you just typed "normal", so it would be interesting how that string got there.

So BV's question was a very good one: How and where was that file created?

Cheers,
Oliver

anjalorenz's picture

Moin,

we had a similar problem yesterday, so maybe our experience might be helpful for other users:

Our H5P plugin was up-to-date, but the validation of the H5P package failed anyway, because invalid data was provided in the h5p.json file. In our case, the fields "author comments" and "log" were specified both once. Both are fields in the metadata of the H5P file. We then deleted these fields [1] and then opened and saved it again with Lumi (I don't know if this last step is really needed). Then it worked. I assume that the fields might be filled with a special character (e.g. a dash) or something similar that caused problems.

Maybe it's worth checking whether there are problems in the encryption that can be solved on the software side.

Best regards
Anja

 

[1] How to delete fields in the h5p.json file:

  1. rename the H5P file to ZIP
  2. unzip the package and open h5p.json
  3. delete the arguments of the respective fields manually
  4. zip the package again
  5. rename ZIP to H5P
otacke's picture

Hi Anja!

There was a bug related to those fields (could not cope with line breaks). Is has been fixed a while ago, see https://github.com/h5p/h5p-php-library/pull/109, but the change didn't make it into the moodle plugin until just 3 days ago (1.23.0). Earlier versions (1.22.4-) would have such issues, yes. Could you please deny or confirm that you were using 1.23.0 when you encountered that problem?

Cheers,
Ollie

anjalorenz's picture

Meh, no, our Plugin is older than 1.23.0. Thus maybe Lumi just had fixed the version conflict (what might also be a helpful information).

Best regards
Anja

otacke's picture

You had fixed the problem (or worked around it) yourself by deleting the fields.