I have an HTML, with a CSS style sheet, I upload it to galleries of my 3.0 ojs, but it does not take the style sheet.
Hi @proyrevistas,
Can you describe what you mean by “does not take”? Do you receive an error message?
Regards,
Alec Smecher
Public Knowledge Project Team
I have Html with CSS style, but I can not implement the CSS style, in OJS 3.0.2.0, I do not reconnect it.
Hi @proyrevistas,
Do you receive an error message?
Regards,
Alec Smecher
Public Knowledge Project Team
not, I receive error messge!
I am a newbie, I have to enable some opicon to show them ??
Hi @proyrevistas,
It’s still not clear to me what happens when you try to upload a CSS – could you describe it in detail? Maybe include screenshots?
Regards,
Alec Smecher
Public Knowledge Project Team
I have, html with a css style sheet,. as the following image shows.
When uploading it to my journal, it does not recognize the CSS style.
in this way they were uploaded in the journal:
I can visualize the html online, but without style.
request your help, to be able to apply the style !!
Hi @proyrevistas,
Do you have a reference to the CSS from inside your HTML?
Regards,
Alec Smecher
Public Knowledge Project Team
yes, I attach html code image
Hi @proyrevistas,
When you uploaded the file as a dependent file (you can see the list of dependent files by editing your HTML galley from the workflow), was it named the exact same way as your HTML expects (htmlLigeroGenerico.css
)? What do you see when you edit your HTML galley?
Regards,
Alec Smecher
Public Knowledge Project Team
Yes, it receives the names correctly, when viewing the galley the htmlL does not work with the style sheet, see image. or link: “http://revistas.uis.edu.co/index.php/revistaboletindegeologia/article/view/7953/8217”
But if the images work:
Hi @proyrevistas,
In the HTML you linked above, what does the <link>
element to the article’s stylesheet look like in your raw HTML (before OJS tries to rewrite it)?
Regards,
Alec Smecher
Public Knowledge Project Team
Hello, Asmecher,
Hi @proyrevistas,
Hmm, that looks OK, and OJS is rewriting the link as expected. What do you get for the following SQL query?
SELECT * FROM submission_files WHERE file_id=38036;
Regards,
Alec Smecher
Public Knowledge Project Team
query SQL.
Hi @proyrevistas,
Ah, the file_type
of text/x-asm
is the problem. If you change this to text/css
I suspect this will start working properly.
As for why your system detected a MIME type of text/x-asm
, that’s a complicated answer. Start with this thread and see if you can determine which of the available tools OJS is using to detect MIME types; then you can likely work with that tool to figure out why it’s detecting incorrectly.
Regards,
Alec Smecher
Public Knowledge Project Team
Greetings Alec,
Updating the information for the database solved the problem for the specified css file. We are doing this database update for every css file that we update as a temporary workaround while we look for a permanent solution.
We read the thread you linked and also several other thread online about this behaviour with php and fileinfo. Following the recommendations about comments, reserved words, etc, we couldn’t still solve the problem (only a change in file type from text/x-asm to text/plain)
In this extra thread it says that commenting out the mime_database_path setting in the config.inc.php cause the software to use an internal database but we did that and still is detecting the css files as text/x-asm. The thread also says about software priorities but this is not listed in any order.
So the question is, is there a way to override this priorities for the mime_database_path given in the config.inc.php? The PKP FAQs doesn’t provide additional information than the one in the extra thread.
Hi @hekutoru2kx,
OJS relies on third-party toolsets (usually built into PHP) to detect file types; those tools are what’s misbehaving. If you wanted, you could edit lib/pkp/classes/core/PKPString.inc.php
and find the mime_content_type
function, which is where this is implemented, and force text/x-asm
to map to text/css
– but it would be better to work with the underlying tools to find a server-wide solution.
Regards,
Alec Smecher
Public Knowledge Project Team
Hi @asmecher,
After doing a reasearch of the problem, we realize that is a common problem between php platforms with the fileinfo/mime type with css files, due to lack of ways to identify a css structure and reserved pattern words. It seems that the only way to resolve if to degrade/deactivate the fileinfo library or to customize the platform algorithm of identification.
Considering all the support given, the security politics and the structure of the ojs, we ended modifying the mime_content_type function in the PKPString.inc.php file to add the text/x-asm to the ambiguities section.
// SUGGESTED_EXTENSION:DETECTED_MIME_TYPE => OVERRIDE_MIME_TYPE $ambiguities = array( 'css:text/x-c' => 'text/css', 'css:text/plain' => 'text/css', 'css:text/x-asm' => 'text/css', 'xlsx:application/zip' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xltx:application/zip' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'potx:application/zip' => 'application/vnd.openxmlformats-officedocument.presentationml.template', 'ppsx:application/zip' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'pptx:application/zip' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'sldx:application/zip' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', 'docx:application/zip' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'dotx:application/zip' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', );
With this, the css type is correctly identified with the structure style sheets we are using.
Thanks for your guidance and keep the good work,
Hi @hekutoru2kx,
Yes, that’s a good work-around. I’m thinking it’s probably best not to include it in the OJS distribution, because strictly speaking it’s incorrect to treat x-asm
files as CSS, but the chances of someone legitimately uploading assembly code to the journal are vanishingly small.
Regards,
Alec Smecher
Public Knowledge Project Team