diff options
author | Shaun McCance <shaunm@gnome.org> | 2020-10-26 19:39:02 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2020-10-26 19:39:02 -0400 |
commit | 3bbdfdcea70b0f057eb65f345577b35623888ca4 (patch) | |
tree | c28cd27f4ffecb48c81916f87207ced6cd95b5cf | |
parent | 31f5dc15af8d1dc69d556a870a0b21d95520d7f8 (diff) | |
download | yelp-3bbdfdcea70b0f057eb65f345577b35623888ca4.tar.gz |
Fix links to search results for ghelp documents
Fixes https://gitlab.gnome.org/GNOME/yelp/-/issues/137
-rw-r--r-- | libyelp/yelp-document.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c index 0a86f3f7..346c411d 100644 --- a/libyelp/yelp-document.c +++ b/libyelp/yelp-document.c @@ -1088,8 +1088,12 @@ document_read_contents (YelpDocument *document, while (g_variant_iter_loop (iter, "(&s&s&s&s)", &url, &title, &desc, &icon)) { gchar *xref_uri = NULL; - if (g_str_has_prefix (url, document->priv->doc_uri)) - xref_uri = g_strdup_printf ("xref:%s", url + strlen (document->priv->doc_uri) + 1); + if (g_str_has_prefix (url, document->priv->doc_uri)) { + gchar *urloffset = url + strlen(document->priv->doc_uri) + 1; /* do not free */ + if (urloffset[0] == '?') + urloffset += 1; /* handle oddity of old ghelp URIs */ + xref_uri = g_strdup_printf ("xref:%s", urloffset); + } tmp = g_markup_printf_escaped ("<div><a class='linkdiv' href='%s'><div class='linkdiv'>" "<div class='title'>%s</div>" |