H5P Plugin in WordPress Giving You Crazy Code on Download Attempt?
We ran into this yesterday and it led to all kinds of other nonsense that wasn’t the issue.
What was happening was that when you tried to Reuse>Download an existing H5P file it wouldn’t download it but would print the nonsense that is in the image above.
We ended up going down all kinds of rabbit holes because we were also having an issue with permission and updating H5P libraries. Those issues weren’t related at all but did eat up some serious time. Those things tend to snowball and I end up adding a wheeluser in WHM so I can SSH into a sub-install and mess with folder/file permissions via terminal.1
Anyway, what interests me in some ways is that I finally gave up and posted for help on Twitter at 8:07 this morning. I hate to ask people for help if I haven’t worked pretty hard at solving something.
Early in the hope game but I'm thinking it's a mime type issue.
Not sure why it appeared suddenly though.
— Tom Woodward (@twoodwar) September 22, 2020
By 9:00AM my brain finally kicked loose where I’d seen that weird code-like stuff before . . . expletive-string2 mime types. A bit of Stackoverflow later and I was able to add the following to the .htaccess file and fix the issue by 9:10 or so. Maybe finally giving in releases some mental blocks because this happens fairly often.
AddType application/zip .h5p <FilesMatch "\.(?i:h5p)$"> ForceType application/zip Header set Content-Disposition attachment </FilesMatch>