Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better identify the category of error messages (e.g. "CSS parsing error") #302

Open
rdeltour opened this issue Oct 15, 2013 · 1 comment
Labels
priority: low To be processed when time allows status: accepted Ready to be further processed type: improvement The issue suggests an improvement of an existing feature

Comments

@rdeltour
Copy link
Member

From [email protected] on September 10, 2013 03:33:43

PROBLEM: The attached invalid_media_type.epub file fails epubcheck. Specifically, in its content.opf file, the definitions for the .otf fonts have the incorrect media-type. They should be "application/x-font-opentype", but are mistakenly defined as "text/css". As otf files are binary, interpreting them as text/css generates hundreds of "is not allowed here" warnings. For example:

WARNING: invalid_media_type.epub/OEBPS/Fonts/DejaVuSans-Bold.otf(5): The character 'NEWLINE' is not allowed in 'STRING' expressions
WARNING: invalid_media_type.epub/OEBPS/Fonts/LinLibertine_Re-4.1.8.otf(5145): Token '@????' not allowed here

There is no clear indication that something is wrong with the media-type.

METHOD:
(1) To reproduce the problem, run epubcheck on invalid_media_type.epub. You will get a long list of warnings
(2) I also an attached correct_media_type.epub, where the media-type values in content.opf have been corrected.

RESULT: A long list of "is not allowed here" warnings.

EXPECTED: It would be ideal if there was an error (or warning) indicating the exact source of the problem. Although we have no interest in using it, the FlightCrew utility does give clear errors, including the filename and the line number, for example:

invalid_media_type.epub/OEBPS/content.opf    19    The <item> element's "media-type" attribute has value "text/css", but the file's media type is "application/vnd.ms-opentype".

A message similar to that would be perfect.

Even a more general message would be helpful, something like: "In content.opf, an has a media-type declared as a text mimetype, but is referencing a binary file."

PLATFORM: I am using epubcheck-3.0.1, on both OSX 10.8.5 (dev) and Linux 2.6.18-194.el5 (prod)

Attachment: invalid_media_type.epub correct_media_type.epub

Original issue: http://code.google.com/p/epubcheck/issues/detail?id=303

@rdeltour
Copy link
Member Author

Doing type sniffing is out of scope for EPUBCheck, but I suppose we could better identified these messages are related to CSS parsing, which could already give a hint of what's happening.

Let's try to tackle that during the message refactoring after v4.2.0.

@rdeltour rdeltour added priority: low To be processed when time allows status: accepted Ready to be further processed labels Feb 26, 2019
@rdeltour rdeltour changed the title epubcheck does not identify certain errors related to incorrect media-types Better identify the category of error messages (e.g. "CSS parsing error") Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low To be processed when time allows status: accepted Ready to be further processed type: improvement The issue suggests an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant