commit f0e1066993324b2cdecd9f8ed16b8b1a074ab4a0
parent 454f416154a4aac57c9956f6458b2ae6380a85a9
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 6 Apr 2025 11:09:44 +0200
fix language pattern match logic
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
@@ -202,6 +202,9 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
p->mime_type);
if (q < best_mime_q)
continue;
+ q = TALER_pattern_matches (lang,
+ p->language);
+ /* create 'available-languages' (for this mime-type) */
if (NULL == langs)
{
langs = GNUNET_strdup (p->language);
@@ -217,8 +220,6 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
p->language);
GNUNET_free (tmp);
}
- q = TALER_pattern_matches (langs,
- p->language);
if (q < best_lang_q)
continue;
best_lang_q = q;
diff --git a/src/util/lang.c b/src/util/lang.c
@@ -77,7 +77,8 @@ TALER_pattern_matches (const char *pattern,
char *qp = strtok_r (NULL, ";", &sptr2);
double q = 1.0;
- GNUNET_assert (NULL != lp);
+ if (NULL == lp)
+ continue;
while (isspace ((int) *lp))
lp++;
if (NULL != qp)