summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2015-04-10 12:21:22 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2015-04-10 12:47:28 +0200
commit316b36ddd86562550f2e86a271fece9f316514cc (patch)
tree5ca2f8ad7d0ff0d4de6dea39ae44184f0e7a1c26
parent49dbca2dc84f9558bf24f81ca7b86e67b596ab49 (diff)
downloadyelp-316b36ddd86562550f2e86a271fece9f316514cc.tar.gz
yelp-uri-builder: Fix ghelp documents
Accoring to the yelp-uri code, a ghelp uri can contain a /file after the document, but I haven't seen any ghelp document using that. Current code tries to deal with that /file by appending a trailing slash after the path, but that only orks for the document index, any other pages don't work. This patch removes that code to handle ghelp uris like help ones, only adding the leading slash.
-rw-r--r--libyelp/yelp-uri-builder.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/libyelp/yelp-uri-builder.c b/libyelp/yelp-uri-builder.c
index 09639c95..e2b670e7 100644
--- a/libyelp/yelp-uri-builder.c
+++ b/libyelp/yelp-uri-builder.c
@@ -32,24 +32,11 @@ build_network_uri (const gchar *uri)
soup_uri = soup_uri_new (uri);
/* Build the URI that will be passed to WebKit. Relative URIs will be
- automatically reolved by WebKit, so we need to add a leading slash to
- help: and ghelp: URIs to be considered as absolute by WebKit. The last
- component of the URI is considered as a file by WebKit, unless there's
- a trailing slash. For help: URIs this assumption is always correct, because
- the page ID is part of the URI, and when resolved by WebKit, the page ID is
- removed and the relative path is appended to the document URI. For ghelp: URIs
- where the page ID is part of the query, we need to add a slash after the
- document URI so that it's considered a directory and the relative path is appended
- to the document URI.
- */
- if (g_str_equal (soup_uri->scheme, "ghelp") || g_str_equal (soup_uri->scheme, "gnome-help")) {
- /* Pages are part of the query, add leading and trailing slash */
- path = g_strdup_printf ("/%s/", soup_uri->path);
- soup_uri_set_path (soup_uri, path);
- g_free (path);
- }
- else if (g_str_equal (soup_uri->scheme, "help") || g_str_equal (soup_uri->scheme, "help-list")) {
- /* Page is part of the path, add only leading slash */
+ * automatically resolved by WebKit, so we need to add a leading slash to
+ * help: and ghelp: URIs to be considered as absolute by WebKit.
+ */
+ if (g_str_equal (soup_uri->scheme, "ghelp") || g_str_equal (soup_uri->scheme, "gnome-help") ||
+ g_str_equal (soup_uri->scheme, "help") || g_str_equal (soup_uri->scheme, "help-list")) {
path = g_strdup_printf ("/%s", soup_uri->path);
soup_uri_set_path (soup_uri, path);
g_free (path);