summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-12-07 10:59:50 +0000
committerRichard Hughes <richard@hughsie.com>2016-12-07 11:01:16 +0000
commit44b5acdc4332540b6cda6def59e156a1319f5585 (patch)
tree8d75d4b307a43daa32cb78be5c1fff18e3807276
parent3c4cfd91bcbbc749f482fbd15bf72c9d32b67a11 (diff)
downloadappstream-glib-44b5acdc4332540b6cda6def59e156a1319f5585.tar.gz
trivial: Don't include trailing whitespace from AppData files
Translators sometimes leave extra whitespace, so if we're parsing without AS_NODE_FROM_XML_FLAG_LITERAL_TEXT then just swallow the trailing spaces.
-rw-r--r--data/tests/firmware/2_0_2/firmware.metainfo.xml8
-rw-r--r--libappstream-builder/asb-self-test.c4
-rw-r--r--libappstream-glib/as-node.c5
-rw-r--r--libappstream-glib/as-self-test.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/data/tests/firmware/2_0_2/firmware.metainfo.xml b/data/tests/firmware/2_0_2/firmware.metainfo.xml
index c459bd2..11028c9 100644
--- a/data/tests/firmware/2_0_2/firmware.metainfo.xml
+++ b/data/tests/firmware/2_0_2/firmware.metainfo.xml
@@ -2,8 +2,8 @@
<!-- Copyright 2015 Richard Hughes <richard@hughsie.com> -->
<component type="firmware">
<id>com.hughski.ColorHug2.firmware</id>
- <name>ColorHug Firmware</name>
- <summary>Firmware for the ColorHug Colorimeter</summary>
+ <name>ColorHug Firmware </name>
+ <summary>Firmware for the ColorHug Colorimeter </summary>
<description>
<p>
Updating the firmware on your ColorHug device improves performance and
@@ -22,9 +22,9 @@
<release version="2.0.2" timestamp="1424116753">
<location>http://www.hughski.com/downloads/colorhug2/firmware/colorhug-2.0.2.cab</location>
<description>
- <p>This unstable release adds the following features:</p>
+ <p>This unstable release adds the following features: </p>
<ul>
- <li>Add TakeReadingArray to enable panel latency measurements</li>
+ <li>Add TakeReadingArray to enable panel latency measurements </li>
<li>
Speed up the auto-scaled measurements considerably, using 256ms
as the smallest sample duration
diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c
index 8515176..1c60322 100644
--- a/libappstream-builder/asb-self-test.c
+++ b/libappstream-builder/asb-self-test.c
@@ -550,7 +550,7 @@ asb_test_context_test_func (AsbTestContextMode mode)
"<li>Speed up the auto-scaled measurements considerably, using 256ms "
"as the smallest sample duration</li></ul></description>\n"
"<size type=\"installed\">14</size>\n"
- "<size type=\"download\">2011</size>\n"
+ "<size type=\"download\">2015</size>\n"
"</release>\n"
"</releases>\n"
"<provides>\n"
@@ -835,7 +835,7 @@ asb_test_firmware_func (void)
"<li>Speed up the auto-scaled measurements considerably, using 256ms "
"as the smallest sample duration</li></ul></description>\n"
"<size type=\"installed\">14</size>\n"
- "<size type=\"download\">2011</size>\n"
+ "<size type=\"download\">2015</size>\n"
"</release>\n"
"<release timestamp=\"1424116753\" version=\"2.0.1\">\n"
"<location>http://www.hughski.com/downloads/colorhug2/firmware/colorhug-2.0.1.cab</location>\n"
diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c
index 23ad52d..f02d155 100644
--- a/libappstream-glib/as-node.c
+++ b/libappstream-glib/as-node.c
@@ -503,9 +503,10 @@ as_node_reflow_text (const gchar *text, gssize text_len)
g_auto(GStrv) split = NULL;
g_autoptr(GString) tmp = NULL;
- /* all on one line */
+ /* all on one line, no trailing or leading whitespace */
if (g_strstr_len (text, text_len, "\n") == NULL &&
- !g_str_has_prefix (text, " ")) {
+ !g_str_has_prefix (text, " ") &&
+ !g_str_has_suffix (text, " ")) {
gsize len;
len = text_len >= 0 ? (gsize) text_len : strlen (text);
return as_ref_string_new_copy_with_length (text, len);
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index 3aefcbf..ae002b4 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -3351,7 +3351,7 @@ as_test_store_cab_func (void)
"<li>Speed up the auto-scaled measurements considerably, using 256ms as"
" the smallest sample duration</li></ul></description>\n"
"<size type=\"installed\">14</size>\n"
- "<size type=\"download\">2011</size>\n"
+ "<size type=\"download\">2015</size>\n"
"</release>\n"
"</releases>\n"
"<provides>\n"