HTML galley not detected

Hi there,

I have found something strange while trying to upload a html file in our Version of OJS and I wanted to share it with you in case someone else has the same problem:
My goal was to upload a html file without an html- or body-tag, because these are aleady provided by OJS. Furthermore thie file should be displayed in the site layout. I also knew that it could work, because I had tried it before with a very plain file which consisted only an “h3”, an “p” and and a link.
But this time it was important to adress parts of the file specifically, so I put them in divs. But after that, OJS couldn’t detect it as a html file anymore. The type was always detected as html/plain. It tried to force it by adding html-tags and OJS recognized the type as text/html, but still didn’t set the html_gally in the database to 1, so it was displayed as an html side, but not inside the journal layout.
So It tried to add some tags, to let the system know it was indeed a html file. In the end it needed an a-tag, which could be empty and which could be commented out, but it had to be put in the beginning of the file. After that the system detected the right file type.
By the way in the the line “mime_database_path = /etc/magic.mime” commented out.

I guess the system (or the server) needs some typical html code to recognize the file type, which obviously a div is not.

If anyone has some suggestions what could be done in cases like this, I would be happy to hear it. Otherwise I will try to do the layout without divs.

Kind regards

Hi @UBWolf,

This is a longstanding OJS 2.x issue: HTML files aren’t generally properly detected unless they have a <html> element, but OJS then embeds that <html> element within its own markup, thus generating invalid HTML.

We’ve resolved this in OJS 3.x by using iframes. We’re not likely to resolve the issue in OJS 2.x, in part because all browsers are able to present the invalid HTML without problems.

Alec Smecher
Public Knowledge Project Team