summaryrefslogtreecommitdiff
path: root/external/libepubgen/libepubgen-validation1.patch.1
diff options
context:
space:
mode:
Diffstat (limited to 'external/libepubgen/libepubgen-validation1.patch.1')
-rw-r--r--external/libepubgen/libepubgen-validation1.patch.149
1 files changed, 49 insertions, 0 deletions
diff --git a/external/libepubgen/libepubgen-validation1.patch.1 b/external/libepubgen/libepubgen-validation1.patch.1
new file mode 100644
index 000000000000..18707e76205d
--- /dev/null
+++ b/external/libepubgen/libepubgen-validation1.patch.1
@@ -0,0 +1,49 @@
+From 96e9786f5aba1078251f36e58feefc8d953cdea0 Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos@collabora.co.uk>
+Date: Tue, 8 Aug 2017 16:54:24 +0200
+Subject: [PATCH 1/3] EPUBGenerator: fix validation error with empty
+ dc:identifier element
+
+<http://www.idpf.org/epub/31/spec/epub-packages.html#sec-opf-dcidentifier>
+"3.4.3.2.1 The identifier Element" says that the character content is
+not optional, so write it.
+---
+ configure.ac | 3 +++
+ src/lib/EPUBGenerator.cpp | 14 +++++++++++++-
+ 2 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
+index 0d0f866..507eb14 100644
+--- a/src/lib/EPUBGenerator.cpp
++++ b/src/lib/EPUBGenerator.cpp
+@@ -7,6 +7,10 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
++#include <boost/uuid/uuid.hpp>
++#include <boost/uuid/uuid_generators.hpp>
++#include <boost/uuid/uuid_io.hpp>
++
+ #include "EPUBCSSSink.h"
+ #include "EPUBHTMLGenerator.h"
+ #include "EPUBGenerator.h"
+@@ -193,7 +197,15 @@ void EPUBGenerator::writeRoot()
+
+ RVNGPropertyList identifierAttrs;
+ identifierAttrs.insert("id", uniqueId);
+- sink.insertEmptyElement("dc:identifier", identifierAttrs);
++ identifierAttrs.insert("opf:scheme", "UUID");
++ sink.openElement("dc:identifier", identifierAttrs);
++ // The identifier element is required to have a unique character content.
++ std::stringstream identifierStream("urn:uuid:");
++ boost::uuids::uuid uuid = boost::uuids::random_generator()();
++ identifierStream << uuid;
++ std::string identifierCharactrs = identifierStream.str();
++ sink.insertCharacters(identifierCharactrs.c_str());
++ sink.closeElement("dc:identifier");
+
+ sink.openElement("dc:title");
+ sink.closeElement("dc:title");
+--
+2.12.3
+