summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2015-04-10 12:21:22 +0200
committerDavid King <amigadave@amigadave.com>2015-06-22 14:55:27 +0100
commit76210eb811a0014012b7798ea78754687666ce79 (patch)
treefec8f629c94e2260b30cfd113a9a61bbd12f565e
parent9ecf34cea6296c6fd7fc13ed76e482b6b7bfde82 (diff)
downloadyelp-76210eb811a0014012b7798ea78754687666ce79.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);