From 45655b8265349d8e94b7472b6deb54adb3a63f38 Mon Sep 17 00:00:00 2001
From: Felix Potthast <mail@ninjakoa.la>
Date: Wed, 20 Feb 2019 10:38:29 +0000
Subject: [PATCH 614/682] glib-compile-resources: Fixes #1675

---
 gio/glib-compile-resources.c           |  2 +-
 gio/tests/111_digit_test.gresource.xml |  6 +++++
 gio/tests/meson.build                  | 25 ++++++++++++++++--
 gio/tests/resources.c                  | 35 ++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 3 deletions(-)
 create mode 100644 gio/tests/111_digit_test.gresource.xml

diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c
index 60ccdbf81..f04ea488b 100644
--- a/gio/glib-compile-resources.c
+++ b/gio/glib-compile-resources.c
@@ -992,7 +992,7 @@ main (int argc, char **argv)
 	    {
 	      const char *first = G_CSET_A_2_Z G_CSET_a_2_z "_";
 	      const char *rest = G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "_";
-	      if (strchr ((i == 0) ? first : rest, base[i]) != NULL)
+	      if (strchr ((s->len == 0) ? first : rest, base[i]) != NULL)
 		g_string_append_c (s, base[i]);
 	      else if (base[i] == '-')
 		g_string_append_c (s, '_');
diff --git a/gio/tests/111_digit_test.gresource.xml b/gio/tests/111_digit_test.gresource.xml
new file mode 100644
index 000000000..00efcc315
--- /dev/null
+++ b/gio/tests/111_digit_test.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/digit_test">
+    <file>test1.txt</file>
+  </gresource>
+</gresources>
