From 50d70a789d93cdc069229c79e788de2a908523f5 Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Mon, 27 May 2024 13:18:39 +0200 Subject: [PATCH 1/5] --longDescription is not mandatory --- src/zimwriterfs/zimwriterfs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zimwriterfs/zimwriterfs.cpp b/src/zimwriterfs/zimwriterfs.cpp index fc48d517..4c56ff38 100644 --- a/src/zimwriterfs/zimwriterfs.cpp +++ b/src/zimwriterfs/zimwriterfs.cpp @@ -186,8 +186,6 @@ void usage() std::cout << "\t-t, --title\t\ttitle of the ZIM file" << std::endl; std::cout << "\t-d, --description\tshort description of the content" << std::endl; - std::cout << "\t-L, --longDescription\tlong description of the content" - << std::endl; std::cout << "\t-c, --creator\t\tcreator(s) of the content" << std::endl; std::cout << "\t-p, --publisher\t\tcreator of the ZIM file itself" << std::endl; @@ -204,6 +202,8 @@ void usage() << std::endl; std::cout << "\t-h, --help\t\tprint this help" << std::endl; std::cout << "\t-V, --version\t\tprint the version number" << std::endl; + std::cout << "\t-L, --longDescription\tlong description of the content" + << std::endl; std::cout << "\t-m, --clusterSize\tnumber of bytes per ZIM cluster (default: 2048Kb)" << std::endl; From aa7db98a178a78d767c8922f4ba6ab9cfb207cda Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sun, 2 Jun 2024 16:52:42 +0200 Subject: [PATCH 2/5] --name is mandatory --- src/zimwriterfs/zimwriterfs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zimwriterfs/zimwriterfs.cpp b/src/zimwriterfs/zimwriterfs.cpp index 4c56ff38..c2149e7f 100644 --- a/src/zimwriterfs/zimwriterfs.cpp +++ b/src/zimwriterfs/zimwriterfs.cpp @@ -76,6 +76,7 @@ bool thereAreMissingArguments() return false; return creator.empty() + || name.empty() || publisher.empty() || description.empty() || language.empty() From edd9e7032a349c3e0cd45b1b50eda717ddbe3f35 Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sun, 2 Jun 2024 17:03:39 +0200 Subject: [PATCH 3/5] Title is mandatory --- src/zimwriterfs/zimwriterfs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zimwriterfs/zimwriterfs.cpp b/src/zimwriterfs/zimwriterfs.cpp index c2149e7f..a685c37b 100644 --- a/src/zimwriterfs/zimwriterfs.cpp +++ b/src/zimwriterfs/zimwriterfs.cpp @@ -81,6 +81,7 @@ bool thereAreMissingArguments() || description.empty() || language.empty() || welcome.empty() + || title.empty() || illustration.empty(); } From 0e3c1b5601a3c2d46240c99cd3324b61ea036bfb Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sun, 2 Jun 2024 17:07:28 +0200 Subject: [PATCH 4/5] -a (tags) needs an argument --- src/zimwriterfs/zimwriterfs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zimwriterfs/zimwriterfs.cpp b/src/zimwriterfs/zimwriterfs.cpp index a685c37b..df801457 100644 --- a/src/zimwriterfs/zimwriterfs.cpp +++ b/src/zimwriterfs/zimwriterfs.cpp @@ -285,7 +285,7 @@ void parse_args(int argc, char** argv) do { c = getopt_long( - argc, argv, "ahVvijxuw:I:t:d:c:l:p:r:e:n:m:J:UBL:", long_options, &option_index); + argc, argv, "a:hVvijxuw:I:t:d:c:l:p:r:e:n:m:J:UBL:", long_options, &option_index); if (c != -1) { switch (c) { From 88cf91642baec4e38b1986d4a8c4187db3df8ebb Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sun, 2 Jun 2024 17:17:26 +0200 Subject: [PATCH 5/5] Better check --longDescription --- src/metadata_constraints.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/metadata_constraints.cpp b/src/metadata_constraints.cpp index 48c8e1c4..30796d4b 100644 --- a/src/metadata_constraints.cpp +++ b/src/metadata_constraints.cpp @@ -27,6 +27,7 @@ const Metadata::ReservedMetadataTable reservedMetadataInfoTable = { METADATA_ASSERT("LongDescription shouldn't be shorter than Description") { - return !data.has("LongDescription") - || data["LongDescription"].size() >= data["Description"].size(); + return !data.has("LongDescription") || + data["LongDescription"].size() == 0 || + data["LongDescription"].size() >= data["Description"].size(); }