mxp1988 / epubcheck

Automatically exported from code.google.com/p/epubcheck
MIT License
0 stars 0 forks source link

error message "Filename contains spaces" is thrown twice #239

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
PROBLEM:

My test EPUB contains two images whose filenames contain spaces.
As expected, epubcheck 3.0 is raising an error.
BUT: the error message is thrown twice!

METHOD:

What steps will reproduce the problem?
1. download the attached demo epub
2. validate with epubcheck 3.0

RESULT:

Epubcheck Version 3.0

Validating against EPUB version 2.0
WARNING: temp/temp.epub/OEBPS/images/cover identifier.jpg: Filename contains 
spaces. Consider changing filename such that URI escaping is not necessary
WARNING: temp/temp.epub/OEBPS/images/Tuebingen Neckarfront.jpg: Filename 
contains spaces. Consider changing filename such that URI escaping is not 
necessary
WARNING: temp/temp.epub/OEBPS/images/Tuebingen Neckarfront.jpg: Filename 
contains spaces. Consider changing filename such that URI escaping is not 
necessary
WARNING: temp/temp.epub/OEBPS/images/cover identifier.jpg: Filename contains 
spaces. Consider changing filename such that URI escaping is not necessary

Check finished with warnings or errors

EXPECTED:

The error message shouldn't be thrown twice!

PLATFORM:

Windows 7 (64bit), Java 1.6.0_37 (32bit)

Original issue reported on code.google.com by tobias.c...@gmail.com on 8 Jan 2013 at 4:04

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r444.

Original comment by tobias.c...@gmail.com on 24 Mar 2013 at 2:45

GoogleCodeExporter commented 8 years ago
Error is thrown twice because all files were double checked:

 * First time in OCFChecker.java:231 when checking the OPF file with opfChecker.runChecks();
 * Second time 24 lines later when iterating over every OCF zip entry. Check performed with OCFFilenameChecker.checkCompatiblyEscaped(...);

I suppose, the first check is for checking all OPF manifested files and the 
second check for all unmanifested files.
At a first glance, removing the first check makes more sense, because when a 
file is manifested in OPF and missing, the OPF check complains about a missing 
file and we shouldn't report that the file URI contains spaces. If the file is 
present and contains spaces in its name but is unmanifested, the checker would 
complain anyway ("exists in the zip file, but is not declared in the OPF file").
BUT: when removing the first check, single OPF file validation with "-mode opf" 
wouldn't invoke checkCompatiblyEscaped() anymore. This wouldn't be good.

Therefore my patch provided with r444 only calles checkCompatiblyEscaped() when 
'xrefChecker' Object is null which is an indicator for single file validation. 
(Had no better possibility in mind since "mode" isn't available in 
OPFChecker.java).

Summary: Both EPUB and single OPF file validation still check on broken 
filenames, but not twice anymore. I also added additional tests for EPUB 3 and 
single OPF file validation.

Original comment by tobias.c...@gmail.com on 24 Mar 2013 at 2:49

GoogleCodeExporter commented 8 years ago

Original comment by tobias.c...@gmail.com on 24 Mar 2013 at 4:10

GoogleCodeExporter commented 8 years ago

Original comment by markus.g...@gmail.com on 26 Mar 2013 at 10:41