epubcheck icon indicating copy to clipboard operation
epubcheck copied to clipboard

Improve the mode selection (with better file extension detection)

Open ezhukov opened this issue 6 years ago • 1 comments

EPUBCheck's mode selection should be improved:

  • when --mode isn't specified, try to select a mode automatically based on the file extension
  • make .zip extensions trigger the EPUB mode
  • when the extension isn't recognized, issue a WARNING and try to process the file as an EPUB archive anyway

original issue comment:

This is an old bug (#490) which apparently wasn't fixed in the latest release. See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773366 for new details.

ezhukov avatar Nov 28 '18 07:11 ezhukov

This is an old bug (#490) which apparently wasn't fixed in the latest release.

I just had a look and it seems it's a bit more complex: the issue is that without an .epub extension, EPUBCheck will assume the file is not an EPUB and is expecting a --mode option to specify which single-file validation it should run.

You can work around that by specifying the --profile default option, which forces the EPUB mode and will validate the given file as EPUB (issuing a WARNING about the wrong extension).

I agree this whole behavior is too confusing however; ideally EPUBCheck should do better at selecting a mode from the extension, and try to peak at the file (as if it was an EPUB archive) when it doesn't recognize the extension.

rdeltour avatar Nov 28 '18 08:11 rdeltour