From 73b0ee879624ed196ca9a18451771297f75d2084 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Wed, 27 Mar 2019 12:03:32 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20report=20ZIP=20checks=20after=20the=20'V?= =?UTF-8?q?alidating=E2=80=A6'=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internal changes: - move the zip header checks from the `EpubCheck` class to the `OCFChecker` class - run the checks _after_ the "Validating using EPUB version…" message - make sure the checks are run in any case even when the validation aborts before the "Validating using EPUB version…" message. Test changes: - add a CLI test case for the message ordering - update the invalid mimetype test files to be based on the minimal EPUB - remove a duplicate test case (`lorem-mimetype-2`) Fix #1025 --- .../com/adobe/epubcheck/api/EpubCheck.java | 73 +----------- .../com/adobe/epubcheck/ocf/OCFChecker.java | 107 ++++++++++++++++- .../adobe/epubcheck/api/Epub20CheckTest.java | 2 +- .../api/Epub30CheckExpandedTest.java | 9 +- .../java/com/adobe/epubcheck/cli/CLITest.java | 25 ++++ .../invalid/lorem-mimetype-2/EPUB/lorem.css | 6 - .../invalid/lorem-mimetype-2/EPUB/lorem.opf | 17 --- .../invalid/lorem-mimetype-2/EPUB/lorem.xhtml | 108 ------------------ .../lorem-mimetype-2/META-INF/container.xml | 7 -- .../invalid/lorem-mimetype/EPUB/lorem.css | 6 - .../invalid/lorem-mimetype/EPUB/lorem.opf | 17 --- .../invalid/lorem-mimetype/EPUB/lorem.xhtml | 108 ------------------ .../lorem-mimetype/META-INF/container.xml | 7 -- .../expanded/invalid/lorem-mimetype/mimetype | 1 - .../META-INF/container.xml | 6 + .../OPS/content_001.xhtml | 11 ++ .../OPS/nav.xhtml | 19 +++ .../OPS/package.opf | 16 +++ .../mimetype | 0 19 files changed, 187 insertions(+), 358 deletions(-) delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.css delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.opf delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.xhtml delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype-2/META-INF/container.xml delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.css delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.opf delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.xhtml delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype/META-INF/container.xml delete mode 100644 src/test/resources/30/expanded/invalid/lorem-mimetype/mimetype create mode 100644 src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/META-INF/container.xml create mode 100644 src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/content_001.xhtml create mode 100644 src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/nav.xhtml create mode 100644 src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/package.opf rename src/test/resources/30/expanded/invalid/{lorem-mimetype-2 => mimetype-file-incorrect-value}/mimetype (100%) diff --git a/src/main/java/com/adobe/epubcheck/api/EpubCheck.java b/src/main/java/com/adobe/epubcheck/api/EpubCheck.java index 40b0fc0af..a9c8cea98 100644 --- a/src/main/java/com/adobe/epubcheck/api/EpubCheck.java +++ b/src/main/java/com/adobe/epubcheck/api/EpubCheck.java @@ -22,7 +22,6 @@ package com.adobe.epubcheck.api; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -41,7 +40,6 @@ import com.adobe.epubcheck.opf.DocumentValidator; import com.adobe.epubcheck.opf.OPFData; import com.adobe.epubcheck.opf.ValidationContext.ValidationContextBuilder; -import com.adobe.epubcheck.util.CheckUtil; import com.adobe.epubcheck.util.DefaultReportImpl; import com.adobe.epubcheck.util.EPUBVersion; import com.adobe.epubcheck.util.ResourceUtil; @@ -210,7 +208,6 @@ public boolean validate() public int doValidate() { ZipFile zip = null; - FileInputStream epubIn = null; try { if (!epubFile.exists()) @@ -219,13 +216,11 @@ public int doValidate() return 2; } - epubIn = new FileInputStream(epubFile); - checkEpubHeader(epubIn); zip = new ZipFile(epubFile); OCFPackage ocf = new OCFZipPackage(zip); - OCFChecker checker = new OCFChecker(new ValidationContextBuilder().ocf(ocf).report(report) - .profile(profile).build()); + OCFChecker checker = new OCFChecker(new ValidationContextBuilder() + .path(epubFile.getAbsolutePath()).ocf(ocf).report(report).profile(profile).build()); checker.runChecks(); String extension = ResourceUtil.getExtension(epubFile.getName()); @@ -236,16 +231,14 @@ public int doValidate() c.checkPackage(); } catch (IOException e) { + // run ZIP header checks in any case before returning + OCFChecker.checkZipHeader(epubFile, report); report.message(MessageId.PKG_008, EPUBLocation.create(epubFile.getName(), ""), e.getMessage()); } finally { try { - if (epubIn != null) - { - epubIn.close(); - } if (zip != null) { zip.close(); @@ -285,62 +278,4 @@ void checkExtension(OCFPackage ocf, String extension) } } - void checkEpubHeader(FileInputStream epubIn) - throws IOException - { - byte[] header = new byte[58]; - - int readCount = epubIn.read(header); - if (readCount != -1) - { - while (readCount < header.length) - { - int read = epubIn.read(header, readCount, header.length - readCount); - // break on eof - if (read == -1) - { - break; - } - readCount += read; - } - } - - if (readCount != header.length) - { - report.message(MessageId.PKG_003, EPUBLocation.create(epubFile.getName(), "")); - } - else - { - int fnsize = getIntFromBytes(header, 26); - int extsize = getIntFromBytes(header, 28); - - if (header[0] != 'P' && header[1] != 'K') - { - report.message(MessageId.PKG_004, EPUBLocation.create(epubFile.getName())); - } - else if (fnsize != 8) - { - report.message(MessageId.PKG_006, EPUBLocation.create(epubFile.getName())); - } - else if (extsize != 0) - { - report.message(MessageId.PKG_005, EPUBLocation.create(epubFile.getName()), extsize); - } - else if (!CheckUtil.checkString(header, 30, "mimetype")) - { - report.message(MessageId.PKG_006, EPUBLocation.create(epubFile.getName())); - } - else if (!CheckUtil.checkString(header, 38, "application/epub+zip")) - { - report.message(MessageId.PKG_007, EPUBLocation.create("mimetype")); - } - } - } - - private int getIntFromBytes(byte[] bytes, int offset) - { - int hi = 0xFF & bytes[offset + 1]; - int lo = 0xFF & bytes[offset]; - return hi << 8 | lo; - } } diff --git a/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java b/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java index 7adec535c..967e34757 100755 --- a/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java +++ b/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java @@ -24,6 +24,8 @@ import static com.adobe.epubcheck.opf.ValidationContext.ValidationContextPredicates.*; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.text.Normalizer; @@ -64,7 +66,6 @@ public class OCFChecker { - @SuppressWarnings("unchecked") private static final ValidatorMap validatorMap = ValidatorMap.builder() .put(Predicates.and(path(OCFData.containerEntry), version(EPUBVersion.VERSION_2)), XMLValidators.CONTAINER_20_RNG) @@ -114,7 +115,11 @@ public void runChecks() ocf.setReport(report); if (!ocf.hasEntry(OCFData.containerEntry)) { - report.message(MessageId.RSC_002, EPUBLocation.create(ocf.getName())); + checkZipHeader(); // run ZIP header checks in any case before returning + // do not report the missing container entry if a fatal error was already reported + if (report.getFatalErrorCount() == 0) { + report.message(MessageId.RSC_002, EPUBLocation.create(ocf.getName())); + } return; } long l = ocf.getTimeEntry(OCFData.containerEntry); @@ -130,6 +135,7 @@ public void runChecks() List opfPaths = containerData.getEntries(OPFData.OPF_MIME_TYPE); if (opfPaths == null || opfPaths.isEmpty()) { + checkZipHeader(); // run ZIP header checks in any case before returning report.message(MessageId.RSC_003, EPUBLocation.create(OCFData.containerEntry)); return; } @@ -157,12 +163,14 @@ else if (opfPath.isEmpty()) } else if (!ocf.hasEntry(opfPath)) { + checkZipHeader(); // run ZIP header checks in any case before returning report.message(MessageId.OPF_002, EPUBLocation.create(OCFData.containerEntry), opfPath); return; } } if (rootfileErrorCounter == opfPaths.size()) { + checkZipHeader(); // run ZIP header checks in any case before returning // end validation at this point when @full-path attribute is missing in // container.xml // otherwise, tons of errors would be thrown @@ -179,7 +187,10 @@ else if (!ocf.hasEntry(opfPath)) EPUBVersion detectedVersion = null; final EPUBVersion validationVersion; OPFData opfData = ocf.getOpfData().get(opfPaths.get(0)); - if (opfData == null) return;// The error must have been reported during + if (opfData == null) { + checkZipHeader(); // run ZIP header checks in any case before returning + return;// The error must have been reported during + } // parsing detectedVersion = opfData.getVersion(); report.info(null, FeatureEnum.FORMAT_VERSION, detectedVersion.toString()); @@ -197,6 +208,11 @@ else if (!ocf.hasEntry(opfPath)) validationVersion = detectedVersion; } newContextBuilder.version(validationVersion); + + // + // Check the EPUB file header + // ------------------------------ + checkZipHeader(); // // Compute the validation profile @@ -428,5 +444,90 @@ private void validateRenditionMapping(ValidationContext context) } parser.process(); } + + private void checkZipHeader() + { + checkZipHeader(new File(context.path), report); + } + + public static void checkZipHeader(File epubFile, Report report) { + + FileInputStream epubIn = null; + try + { + + epubIn = new FileInputStream(epubFile); + + byte[] header = new byte[58]; + + int readCount = epubIn.read(header); + if (readCount != -1) + { + while (readCount < header.length) + { + int read = epubIn.read(header, readCount, header.length - readCount); + // break on eof + if (read == -1) + { + break; + } + readCount += read; + } + } + + if (readCount != header.length) + { + report.message(MessageId.PKG_003, EPUBLocation.create(epubFile.getName(), "")); + } + else + { + int fnsize = getIntFromBytes(header, 26); + int extsize = getIntFromBytes(header, 28); + + if (header[0] != 'P' && header[1] != 'K') + { + report.message(MessageId.PKG_004, EPUBLocation.create(epubFile.getName())); + } + else if (fnsize != 8) + { + report.message(MessageId.PKG_006, EPUBLocation.create(epubFile.getName())); + } + else if (extsize != 0) + { + report.message(MessageId.PKG_005, EPUBLocation.create(epubFile.getName()), extsize); + } + else if (!CheckUtil.checkString(header, 30, "mimetype")) + { + report.message(MessageId.PKG_006, EPUBLocation.create(epubFile.getName())); + } + else if (!CheckUtil.checkString(header, 38, "application/epub+zip")) + { + report.message(MessageId.PKG_007, EPUBLocation.create("mimetype")); + } + } + } catch (IOException e) + { + report.message(MessageId.PKG_008, EPUBLocation.create(epubFile.getName(), ""), + e.getMessage()); + } finally + { + try + { + if (epubIn != null) + { + epubIn.close(); + } + } catch (IOException ignored) + { + } + } + } + + private static int getIntFromBytes(byte[] bytes, int offset) + { + int hi = 0xFF & bytes[offset + 1]; + int lo = 0xFF & bytes[offset]; + return hi << 8 | lo; + } } diff --git a/src/test/java/com/adobe/epubcheck/api/Epub20CheckTest.java b/src/test/java/com/adobe/epubcheck/api/Epub20CheckTest.java index 5c2832369..9ff14f1c7 100644 --- a/src/test/java/com/adobe/epubcheck/api/Epub20CheckTest.java +++ b/src/test/java/com/adobe/epubcheck/api/Epub20CheckTest.java @@ -153,7 +153,7 @@ public void testValidateEPUBPBadOpfNamespace() @Test public void testValidateEPUB_mimetypeAndVersion() { - Collections.addAll(expectedErrors, MessageId.PKG_006, MessageId.OPF_001); + Collections.addAll(expectedErrors, MessageId.OPF_001, MessageId.PKG_006); Collections.addAll(expectedFatals, MessageId.OPF_019); testValidateDocument("/invalid/mimetypeAndVersion.epub"); } diff --git a/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java b/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java index 229c599e9..bdf3d3002 100644 --- a/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java +++ b/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java @@ -95,14 +95,7 @@ public void testValidateEPUBPLoremBasicMathml() public void testValidateEPUBPLoremMimetype() { Collections.addAll(expectedErrors, MessageId.PKG_007); - testValidateDocument("invalid/lorem-mimetype"); - } - - @Test - public void testValidateEPUBPLoremMimetype2() - { - Collections.addAll(expectedErrors, MessageId.PKG_007); - testValidateDocument("invalid/lorem-mimetype-2"); + testValidateDocument("invalid/mimetype-file-incorrect-value"); } @Test diff --git a/src/test/java/com/adobe/epubcheck/cli/CLITest.java b/src/test/java/com/adobe/epubcheck/cli/CLITest.java index b3dbb2abb..1c6c8d52f 100644 --- a/src/test/java/com/adobe/epubcheck/cli/CLITest.java +++ b/src/test/java/com/adobe/epubcheck/cli/CLITest.java @@ -290,6 +290,31 @@ public void testLocalizationWithNoLocale() })); } + + @Test + public void testVersionMessageComesFirst() + { + PrintStream outOrig = System.out; + PrintStream errOrig = System.err; + CountingOutStream out = new CountingOutStream(); + System.setOut(new PrintStream(out)); + System.setErr(new PrintStream(out)); + EpubChecker epubChecker = new EpubChecker(); + epubChecker.run( + new String[] { getAbsoluteBasedir(expPath + "invalid/mimetype-file-incorrect-value"), "-mode", "exp", "--locale", "en" }); + System.setOut(outOrig); + System.setErr(errOrig); + int versionMessageIndex = out.getValue().indexOf("Validating using"); + int mimetypeErrorMessageIndex = out.getValue().indexOf("mimetype"); + assertTrue("Version message should be in the output.", + versionMessageIndex >= 0); + assertTrue("PKG-007 should be in the output.", + mimetypeErrorMessageIndex >= 0); + assertTrue("Version message should be printed before PKG-007", + versionMessageIndex < mimetypeErrorMessageIndex); + } + + private int run(String[] args, boolean verbose) { PrintStream outOrig = System.out; diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.css b/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.css deleted file mode 100644 index 0823b7849..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - margin-left : 6em; - margin-right : 16em; - color:black; - font-family: arial, helvetica, sans-serif; -} \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.opf b/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.opf deleted file mode 100644 index 21b06f816..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.opf +++ /dev/null @@ -1,17 +0,0 @@ - - - - urn:uuid:550e8400-e29b-41d4-a716-446667441231 - Lorem Ipsum - la - 2011-09-01 - 2011-09-01T17:18:00Z - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.xhtml b/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.xhtml deleted file mode 100644 index ce440bb00..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/EPUB/lorem.xhtml +++ /dev/null @@ -1,108 +0,0 @@ - - - - Lorem Ipsum - - - -

Lorem Ipsum

-
-

Table of Contents

- -
-
-

Chapter 1

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vel purus mauris, ut - auctor massa. Pellentesque non nunc risus. Fusce a massa augue. Nunc erat ante, - auctor id varius ac, vestibulum non purus. Quisque non dui in sem consectetur - condimentum non ac quam. Quisque ultricies nulla nec urna fringilla pretium. - Pellentesque dictum pulvinar purus in mattis. Aliquam vestibulum orci sed magna - vestibulum a sollicitudin lectus pharetra. Suspendisse luctus risus imperdiet nunc - condimentum malesuada. Nulla fringilla vulputate vestibulum. Sed diam dui, fringilla - quis sagittis nec, viverra et nibh.

- -

Sed sollicitudin accumsan augue, quis pulvinar sem volutpat at. Vestibulum rutrum - bibendum augue sit amet accumsan. Etiam tempus malesuada libero vestibulum - fringilla. Maecenas diam nulla, ultricies ac sodales vitae, viverra ut velit. - Vivamus posuere, mi sit amet vehicula tempus, nibh purus scelerisque enim, non - vestibulum erat arcu in libero. Aliquam vel convallis nibh. Sed in nisi ipsum. Sed - sed est justo, in lacinia nulla.

- -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed luctus est vel lacus - ullamcorper vestibulum. Mauris est sapien, pharetra id feugiat in, ornare a erat. - Nam consectetur vehicula nisi vel faucibus. Morbi blandit augue nec lacus malesuada - venenatis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur - ridiculus mus. Maecenas consectetur, odio vitae suscipit ullamcorper, arcu ligula - pellentesque sem, quis rhoncus enim eros id lectus. Nam ornare dui est, vel posuere - metus. Quisque non nisl metus. Pellentesque id mi nunc, in gravida metus. Nullam - neque tellus, ultricies quis laoreet vitae, imperdiet at nunc. Ut laoreet massa quis - quam vulputate et ultricies nibh consectetur. Donec convallis, nulla id ultricies - ullamcorper, diam tortor interdum dolor, vel tempor lectus urna ut est. Praesent - convallis lacus vitae justo lobortis euismod. In at ante elit.

- -

Aenean quis consectetur justo. Nulla nec enim nisl. Etiam rutrum volutpat tellus, a - scelerisque mauris malesuada sit amet. Suspendisse quis urna augue. Proin tempus - hendrerit libero non cursus. Praesent non massa at nisl luctus facilisis. Nullam - pulvinar, ligula eu porta ornare, mi mi accumsan orci, a iaculis tortor lorem quis - dolor. Phasellus ante nibh, pulvinar ac pulvinar eu, pulvinar ac enim.

- -

Donec vel velit id elit volutpat vestibulum vitae a erat. Duis id est id magna - aliquam pretium nec sit amet nibh. Nullam condimentum suscipit felis, sed interdum - felis dictum ac. Phasellus non nisi quis magna pellentesque auctor. Cras risus - lectus, viverra eu fringilla malesuada, rhoncus et est. Etiam rhoncus pharetra - accumsan. Nullam suscipit tellus felis.

-
-
-

Chapter 2

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet nibh felis. - Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia - Curae; Etiam est sapien, dapibus eget gravida nec, accumsan a turpis. Nunc in nisi - ut dolor elementum porttitor. Mauris hendrerit pulvinar tincidunt. Etiam metus - metus, ullamcorper ut varius lacinia, luctus et nibh. Donec ut metus enim, id - faucibus nunc. Quisque ut iaculis mauris. Duis pellentesque nulla ut eros ultricies - quis condimentum eros adipiscing. Sed porta ultrices diam, ut sagittis lectus mattis - a. Phasellus gravida, sapien vitae mollis interdum, dui neque tempor arcu, ac ornare - leo ipsum ut nisl.

- -

Donec porta, odio et aliquet molestie, felis tellus fermentum leo, id interdum magna - massa quis ligula. Integer elementum mauris eget nisl eleifend facilisis nec sit - amet tellus. Morbi consectetur dignissim egestas. Donec pulvinar, enim eu auctor - cursus, turpis arcu venenatis turpis, eu cursus magna nisl sit amet ante. Curabitur - eleifend arcu eget nibh facilisis mattis. Etiam nisl nunc, semper vitae condimentum - sed, viverra sit amet lacus. Curabitur et orci augue. Suspendisse sollicitudin - vulputate risus, sit amet consequat erat mollis eu. Nunc sodales tincidunt - tincidunt.

- -

Aliquam erat volutpat. Aliquam ornare augue et nulla consequat commodo. Quisque - dictum rhoncus orci vel euismod. Proin leo turpis, adipiscing quis facilisis id, - condimentum sed metus. Nullam pellentesque scelerisque est nec tristique. Nunc augue - turpis, consequat non varius quis, aliquam auctor dolor. Cras luctus dignissim justo - sit amet laoreet. Quisque vel ipsum quis massa suscipit vehicula.

- -

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis - egestas. Vivamus fringilla eleifend magna, vel commodo turpis egestas at. - Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis - egestas. Sed eu lorem quam, et sagittis libero. Maecenas vel ante id sem bibendum - laoreet nec dignissim justo. Class aptent taciti sociosqu ad litora torquent per - conubia nostra, per inceptos himenaeos. Fusce eu lorem orci, eu viverra nisi. Lorem - ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum dapibus commodo - pellentesque. Maecenas quis est accumsan est interdum pharetra egestas nec lorem. - Nam a lectus sit amet justo facilisis suscipit.

- -

Integer dolor dolor, volutpat id commodo id, gravida id risus. Donec consectetur - sollicitudin sem, non auctor urna pulvinar non. Vivamus ipsum nisi, commodo sed - scelerisque id, porta nec massa. Vestibulum ac risus et augue faucibus fermentum ut - et nisi. Integer tincidunt suscipit ipsum, sed interdum felis mollis sed. - Suspendisse potenti. Praesent et mauris et quam consequat tristique. Morbi mi dolor, - pharetra quis rutrum quis, fringilla in tortor. Sed a nulla vitae leo dapibus - cursus. Aliquam erat volutpat. Integer purus purus, dictum id bibendum at, lobortis - quis metus.

-
- - diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/META-INF/container.xml b/src/test/resources/30/expanded/invalid/lorem-mimetype-2/META-INF/container.xml deleted file mode 100644 index a92c6ad86..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/META-INF/container.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.css b/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.css deleted file mode 100644 index 0823b7849..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - margin-left : 6em; - margin-right : 16em; - color:black; - font-family: arial, helvetica, sans-serif; -} \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.opf b/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.opf deleted file mode 100644 index 21b06f816..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.opf +++ /dev/null @@ -1,17 +0,0 @@ - - - - urn:uuid:550e8400-e29b-41d4-a716-446667441231 - Lorem Ipsum - la - 2011-09-01 - 2011-09-01T17:18:00Z - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.xhtml b/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.xhtml deleted file mode 100644 index ce440bb00..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype/EPUB/lorem.xhtml +++ /dev/null @@ -1,108 +0,0 @@ - - - - Lorem Ipsum - - - -

Lorem Ipsum

-
-

Table of Contents

- -
-
-

Chapter 1

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vel purus mauris, ut - auctor massa. Pellentesque non nunc risus. Fusce a massa augue. Nunc erat ante, - auctor id varius ac, vestibulum non purus. Quisque non dui in sem consectetur - condimentum non ac quam. Quisque ultricies nulla nec urna fringilla pretium. - Pellentesque dictum pulvinar purus in mattis. Aliquam vestibulum orci sed magna - vestibulum a sollicitudin lectus pharetra. Suspendisse luctus risus imperdiet nunc - condimentum malesuada. Nulla fringilla vulputate vestibulum. Sed diam dui, fringilla - quis sagittis nec, viverra et nibh.

- -

Sed sollicitudin accumsan augue, quis pulvinar sem volutpat at. Vestibulum rutrum - bibendum augue sit amet accumsan. Etiam tempus malesuada libero vestibulum - fringilla. Maecenas diam nulla, ultricies ac sodales vitae, viverra ut velit. - Vivamus posuere, mi sit amet vehicula tempus, nibh purus scelerisque enim, non - vestibulum erat arcu in libero. Aliquam vel convallis nibh. Sed in nisi ipsum. Sed - sed est justo, in lacinia nulla.

- -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed luctus est vel lacus - ullamcorper vestibulum. Mauris est sapien, pharetra id feugiat in, ornare a erat. - Nam consectetur vehicula nisi vel faucibus. Morbi blandit augue nec lacus malesuada - venenatis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur - ridiculus mus. Maecenas consectetur, odio vitae suscipit ullamcorper, arcu ligula - pellentesque sem, quis rhoncus enim eros id lectus. Nam ornare dui est, vel posuere - metus. Quisque non nisl metus. Pellentesque id mi nunc, in gravida metus. Nullam - neque tellus, ultricies quis laoreet vitae, imperdiet at nunc. Ut laoreet massa quis - quam vulputate et ultricies nibh consectetur. Donec convallis, nulla id ultricies - ullamcorper, diam tortor interdum dolor, vel tempor lectus urna ut est. Praesent - convallis lacus vitae justo lobortis euismod. In at ante elit.

- -

Aenean quis consectetur justo. Nulla nec enim nisl. Etiam rutrum volutpat tellus, a - scelerisque mauris malesuada sit amet. Suspendisse quis urna augue. Proin tempus - hendrerit libero non cursus. Praesent non massa at nisl luctus facilisis. Nullam - pulvinar, ligula eu porta ornare, mi mi accumsan orci, a iaculis tortor lorem quis - dolor. Phasellus ante nibh, pulvinar ac pulvinar eu, pulvinar ac enim.

- -

Donec vel velit id elit volutpat vestibulum vitae a erat. Duis id est id magna - aliquam pretium nec sit amet nibh. Nullam condimentum suscipit felis, sed interdum - felis dictum ac. Phasellus non nisi quis magna pellentesque auctor. Cras risus - lectus, viverra eu fringilla malesuada, rhoncus et est. Etiam rhoncus pharetra - accumsan. Nullam suscipit tellus felis.

-
-
-

Chapter 2

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet nibh felis. - Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia - Curae; Etiam est sapien, dapibus eget gravida nec, accumsan a turpis. Nunc in nisi - ut dolor elementum porttitor. Mauris hendrerit pulvinar tincidunt. Etiam metus - metus, ullamcorper ut varius lacinia, luctus et nibh. Donec ut metus enim, id - faucibus nunc. Quisque ut iaculis mauris. Duis pellentesque nulla ut eros ultricies - quis condimentum eros adipiscing. Sed porta ultrices diam, ut sagittis lectus mattis - a. Phasellus gravida, sapien vitae mollis interdum, dui neque tempor arcu, ac ornare - leo ipsum ut nisl.

- -

Donec porta, odio et aliquet molestie, felis tellus fermentum leo, id interdum magna - massa quis ligula. Integer elementum mauris eget nisl eleifend facilisis nec sit - amet tellus. Morbi consectetur dignissim egestas. Donec pulvinar, enim eu auctor - cursus, turpis arcu venenatis turpis, eu cursus magna nisl sit amet ante. Curabitur - eleifend arcu eget nibh facilisis mattis. Etiam nisl nunc, semper vitae condimentum - sed, viverra sit amet lacus. Curabitur et orci augue. Suspendisse sollicitudin - vulputate risus, sit amet consequat erat mollis eu. Nunc sodales tincidunt - tincidunt.

- -

Aliquam erat volutpat. Aliquam ornare augue et nulla consequat commodo. Quisque - dictum rhoncus orci vel euismod. Proin leo turpis, adipiscing quis facilisis id, - condimentum sed metus. Nullam pellentesque scelerisque est nec tristique. Nunc augue - turpis, consequat non varius quis, aliquam auctor dolor. Cras luctus dignissim justo - sit amet laoreet. Quisque vel ipsum quis massa suscipit vehicula.

- -

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis - egestas. Vivamus fringilla eleifend magna, vel commodo turpis egestas at. - Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis - egestas. Sed eu lorem quam, et sagittis libero. Maecenas vel ante id sem bibendum - laoreet nec dignissim justo. Class aptent taciti sociosqu ad litora torquent per - conubia nostra, per inceptos himenaeos. Fusce eu lorem orci, eu viverra nisi. Lorem - ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum dapibus commodo - pellentesque. Maecenas quis est accumsan est interdum pharetra egestas nec lorem. - Nam a lectus sit amet justo facilisis suscipit.

- -

Integer dolor dolor, volutpat id commodo id, gravida id risus. Donec consectetur - sollicitudin sem, non auctor urna pulvinar non. Vivamus ipsum nisi, commodo sed - scelerisque id, porta nec massa. Vestibulum ac risus et augue faucibus fermentum ut - et nisi. Integer tincidunt suscipit ipsum, sed interdum felis mollis sed. - Suspendisse potenti. Praesent et mauris et quam consequat tristique. Morbi mi dolor, - pharetra quis rutrum quis, fringilla in tortor. Sed a nulla vitae leo dapibus - cursus. Aliquam erat volutpat. Integer purus purus, dictum id bibendum at, lobortis - quis metus.

-
- - diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype/META-INF/container.xml b/src/test/resources/30/expanded/invalid/lorem-mimetype/META-INF/container.xml deleted file mode 100644 index a92c6ad86..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype/META-INF/container.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype/mimetype b/src/test/resources/30/expanded/invalid/lorem-mimetype/mimetype deleted file mode 100644 index 8f3a928e7..000000000 --- a/src/test/resources/30/expanded/invalid/lorem-mimetype/mimetype +++ /dev/null @@ -1 +0,0 @@ -application/something+else \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/META-INF/container.xml b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/META-INF/container.xml new file mode 100644 index 000000000..cd9945b48 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/META-INF/container.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/content_001.xhtml b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/content_001.xhtml new file mode 100644 index 000000000..2f8492a6f --- /dev/null +++ b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/content_001.xhtml @@ -0,0 +1,11 @@ + + + + + Minimal EPUB + + +

Loomings

+

Call me Ishmael.

+ + diff --git a/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/nav.xhtml b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/nav.xhtml new file mode 100644 index 000000000..fb044b8c6 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/nav.xhtml @@ -0,0 +1,19 @@ + + + + + Minimal Nav + + + + + + diff --git a/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/package.opf b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/package.opf new file mode 100644 index 000000000..0d1eec6e9 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/OPS/package.opf @@ -0,0 +1,16 @@ + + + + Minimal EPUB 3.0 + en + NOID + 2017-06-14T00:00:01Z + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/lorem-mimetype-2/mimetype b/src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/mimetype similarity index 100% rename from src/test/resources/30/expanded/invalid/lorem-mimetype-2/mimetype rename to src/test/resources/30/expanded/invalid/mimetype-file-incorrect-value/mimetype