[yelp] Fix links to search results for ghelp documents
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Fix links to search results for ghelp documents
- Date: Mon, 26 Oct 2020 23:39:31 +0000 (UTC)
commit 3bbdfdcea70b0f057eb65f345577b35623888ca4
Author: Shaun McCance <shaunm gnome org>
Date: Mon Oct 26 19:39:02 2020 -0400
Fix links to search results for ghelp documents
Fixes https://gitlab.gnome.org/GNOME/yelp/-/issues/137
libyelp/yelp-document.c | 8 ++++++--
1 file 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>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]