Window 10 content zip error on uploads

Forums: 

 

Hi, i am having an issue with zipping/uploading h5p content files. wondering if you have any ideas?  seems like somthing has changed as this has worked fine in the past.

i create a Course Presentation (crurent version) and download. on testing, I can upload this download file fine. Windows 10 v1803 on a Surface Book 2.

if i repack it with 7Zip as a zip file and try to reload it i get this error. 

No changes to any files, just repack at the root level. I can recreate on other win10 machine.  using Chrome Version 77.0.3865.90 to upload

Files Enclosed

error code

Validating h5p package failed.

File "blob-1.0/" not allowed. Only files with the following extensions are allowed: json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 m4a wav txt pdf rtf doc docx xls xlsx ppt pptx odt ods o

 

thanks for any ideas.

John

 

serettig's picture

The reason why you get this error is that the package validator does not accept packages in which there are zip entries for directories. Normally, when exporting H5P packages with the library, these are omitted and the zip file only contains entries for files. It look like 7-Zip does it's zipping in a different way and that's why you're seeing the error. I'd suggest trying another zip tool for this or writing a script to remove the directory entries.

not sure if follow.. i don't see zip files in the h5p package.  is that what you are seeing/saying? 

seems like something has changed as i have done this many times before.  i have tried a bunch of different zip tools but that all fail to load.  the error seems to interpret the relative path as a file vs a directory.  

 

thanks for your thoughts.

john

 

serettig's picture

The H5P "package" is a zip file that only has a different file extension (.h5p instead of .zip). A zip file consists of "zip entries", which can be files and directories. The H5P package validator does not accept packages that contain zip entries for directories. These are not necessary strictly speaking, as a zip entry for a file can have a path like "directory/file.txt" without the zip entry "directory/" existing.

I'm not sure if you're using the command line version of 7-Zip, but you might want to check out this superuser post concerning excluding directories when creating zip files.

papi Jo's picture

I've had the exact same problem, and serettig has tried to help, but I still do not know how and why it happens (sometimes but not always)...

As I had the same errors "File ... not allowed" when trying to upload a .h5p file (into a wordpress site in my case), generated by the 0 size directory names in the zip/h5p package, here is my problem and kind of solution: 

I can produce zip archives with 7-zip and the windows command line and use the -r switch. But to only include files and no empty directory entries I have to specify each file format which is quite cumbersome:

7z.exe a -tzip archive.zip -r subdir\*.json subdir\*.css subdir\*.png ... and so on.

The much more simple solution with wildcards for any file names with periods DOES NOT work for me - still 0 size directories are included in h5p package:

7z.exe a -tzip archive.zip -r subdir\*.*

So I am looking for a better solution to generate the zip archives - with 7-zip or another windows program. Or possibly an explanation for dummies how to generate h5p packages with the h5p cli ;)
https://h5p.org/h5p-cli-guide#packcmd

Helpful online resources for 7-zip:

https://www.dotnetperls.com/7-zip-examples

https://info.nrao.edu/computing/guide/file-access-and-archiving/7zip/7z-...

https://sevenzip.osdn.jp/chm/cmdline/switches/recurse.htm

Similar issues in the forum:

https://h5p.org/comment/29623

https://h5p.org/node/2817
The compress file fix of studyaid did not worked for me but brought me on the right path to use the windows command line with 7-zip, thank you!

 

 

 

 

 

agree, the only solution that i found that seems to work for me on windows 10 is to use info-zip.zip.exe  still testing this.

http://infozip.sourceforge.net/

here is the command line that i am using

zip.exe -r -D ..\H5PDemoUpload.zip content *

the -D prevents the directory structure being added.  

i could not find a way with 7zip to get it to work either.

it seems something changed between the H5P upload validation and zip structure with Windows 10 in the recent months.  This used to work with just a windows compresss file zip.

i have been able to edit the content.json file and resubmit with 7zip.  but removing/adding file to the package prevents upload.

these comments appears to adrdress the solution as well with zip.exe on windows 10.

https://h5p.org/comment/30255#comment-30255

https://h5p.org/comment/30263#comment-30263

i have not tested with prior versions of windows.

 

for us using Windows this seems to work.

i am creating a new h5p package file with content.json, new images, audios and videos uploads in the package on Windows.