From 60ae950dc2dd34da79ff93bdc6c7b6e04ebaf613 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Thu, 23 Jan 2020 23:05:24 +0300 Subject: [PATCH] [fix #1097] downgrade PKG-012 (filename contains non-ASCII) from WARNING to USAGE --- .../java/com/adobe/epubcheck/messages/DefaultSeverities.java | 2 +- src/main/java/com/adobe/epubcheck/ocf/OCFFilenameChecker.java | 2 -- src/test/java/com/adobe/epubcheck/api/Epub30CheckTest.java | 3 +-- .../test/command_line/listSeverities_expected_results.txt | 4 ++-- .../package/interesting_paths_epub3_expected_results.json | 2 +- .../test/package/interesting_paths_epub3_expected_results.xml | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java b/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java index 2b38a4c18..10d1f58c7 100644 --- a/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java +++ b/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java @@ -276,7 +276,7 @@ private void initialize() severities.put(MessageId.PKG_009, Severity.ERROR); severities.put(MessageId.PKG_010, Severity.WARNING); severities.put(MessageId.PKG_011, Severity.ERROR); - severities.put(MessageId.PKG_012, Severity.WARNING); + severities.put(MessageId.PKG_012, Severity.USAGE); severities.put(MessageId.PKG_013, Severity.ERROR); severities.put(MessageId.PKG_014, Severity.WARNING); severities.put(MessageId.PKG_015, Severity.FATAL); diff --git a/src/main/java/com/adobe/epubcheck/ocf/OCFFilenameChecker.java b/src/main/java/com/adobe/epubcheck/ocf/OCFFilenameChecker.java index 2765da9ce..912a02751 100644 --- a/src/main/java/com/adobe/epubcheck/ocf/OCFFilenameChecker.java +++ b/src/main/java/com/adobe/epubcheck/ocf/OCFFilenameChecker.java @@ -87,8 +87,6 @@ public static String checkCompatiblyEscaped(final String str, Report report, EPU private static String checkNonAsciiFilename(final String str, Report report) { - // TODO change this from warning to a compatibility hint message level - String nonAscii = str.replaceAll("[\\p{ASCII}]", ""); if (nonAscii.length() > 0) { diff --git a/src/test/java/com/adobe/epubcheck/api/Epub30CheckTest.java b/src/test/java/com/adobe/epubcheck/api/Epub30CheckTest.java index 4deae518c..f7b8fa102 100644 --- a/src/test/java/com/adobe/epubcheck/api/Epub30CheckTest.java +++ b/src/test/java/com/adobe/epubcheck/api/Epub30CheckTest.java @@ -225,8 +225,7 @@ public void testDuplicateZipEntriesIssue265() @Test public void testDuplicateZipEntriesIssue265b() { - Collections.addAll(expectedWarnings, MessageId.OPF_061, MessageId.OPF_003, MessageId.PKG_012, - MessageId.PKG_012); + Collections.addAll(expectedWarnings, MessageId.OPF_061, MessageId.OPF_003); // non-unique entry names (after NFC normalization) should raise a warning testValidateDocument("invalid/issue265b.epub"); } diff --git a/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt b/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt index d3af34ad3..4c7d65455 100644 --- a/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt +++ b/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt @@ -143,7 +143,7 @@ OPF-035 WARNING Media type 'text/html' is not appropriate for XHTML/OPS. Use 'ap OPF-036 USAGE Video type '%1$s' might not be supported by reading systems Use 'video/mp4', 'video/h264' or 'video/webm' instead. OPF-037 WARNING Found deprecated media-type '%1$s'. OPF-038 WARNING Media type '%1$s' is not appropriate for an OEBPS 1.2 context; Use 'text/x-oeb1-document' instead. -OPF-039 WARNING Media-type '%1$s' is not appropriate in an OEBPS 1.2 context. Use 'text/x-oeb1-css' instead. +OPF-039 WARNING Media-type '%1$s' is not appropriate in an OEBP S 1.2 context. Use 'text/x-oeb1-css' instead. OPF-040 ERROR Fallback item could not be found. OPF-041 ERROR Fallback-style item could not be found. OPF-042 ERROR '%1$s' is not a permissible spine media-type. @@ -177,7 +177,7 @@ PKG-008 FATAL Unable to read file '%1$s'. PKG-009 ERROR File name contains characters that are not allowed in OCF file names: '%1$s'. PKG-010 WARNING Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename. PKG-011 ERROR Filename is not allowed to end with '.'. -PKG-012 WARNING File name contains the following non-ascii characters: %1$s. Consider changing the filename. +PKG-012 USAGE File name contains the following non-ascii characters: %1$s. Consider changing the filename. PKG-013 ERROR The EPUB file includes multiple OPS renditions. PKG-014 WARNING The EPUB contains empty directory '%1$s'. PKG-015 FATAL Unable to read EPUB contents: %1$s diff --git a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json index 60cf2ee61..e3aabef0b 100644 --- a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json +++ b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json @@ -79,7 +79,7 @@ "suggestion" : null }, { "ID" : "PKG-012", - "severity" : "WARNING", + "severity" : "USAGE", "message" : "File name contains the following non-ascii characters: \u0424. Consider changing the filename.", "additionalLocations" : 0, "locations" : [ { diff --git a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml index 5b0c5c5ae..aae4139bc 100644 --- a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml +++ b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml @@ -17,7 +17,7 @@ RSC-007, ERROR, [Referenced resource 'style.' could not be found in the EPUB.], OPS Content/Cyrillic_Ф.xhtml (6-62) RSC-007, ERROR, [Referenced resource '../XHTML Content/page 02.xhtml' could not be found in the EPUB.], OPS Content/Cyrillic_Ф.xhtml (13-53) PKG-009, ERROR, [File name contains characters that are not allowed in OCF file names: '"{","}"'.], OPS Content/page{03}.xhtml - PKG-012, WARN, [File name contains the following non-ascii characters: Ф. Consider changing the filename.], OPS Content/Cyrillic_Ф.xhtml + PKG-012, USAGE, [File name contains the following non-ascii characters: Ф. Consider changing the filename.], OPS Content/Cyrillic_Ф.xhtml PKG-010, WARN, [Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename.], OPS Content/Cyrillic_Ф.xhtml PKG-010, WARN, [Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename.], OPS Content/More XHTML Content/page01.xhtml PKG-010, WARN, [Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename.], OPS Content/content.opf