diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2015-06-16 12:00:26 +0200 |
---|---|---|
committer | David King <amigadave@amigadave.com> | 2015-06-22 14:56:04 +0100 |
commit | 73b47e275ab57e29e86af4d34964e024bf5d404f (patch) | |
tree | d097ce339ee7ab18bf3aea3979c7728710ad12b7 | |
parent | 5a41c5b39824f18d0f283d04f9478251e9c847cb (diff) | |
download | yelp-73b47e275ab57e29e86af4d34964e024bf5d404f.tar.gz |
yelp-uri: Set docuri and fulluri also when resolving a man full path
This way the canonical uri will man:doc.section instead of file://.
-rw-r--r-- | libyelp/yelp-uri.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c index f63b52a3..91479593 100644 --- a/libyelp/yelp-uri.c +++ b/libyelp/yelp-uri.c @@ -999,10 +999,24 @@ resolve_man_uri (YelpUri *uri) 0, &match_info)) { /* The regexp didn't match, so treat as a file name. */ gchar *newuri; + guint i; + static const char *man_suffixes[] = { "gz", "bz2", "lzma", NULL }; + priv->tmptype = YELP_URI_DOCUMENT_TYPE_MAN; newuri = g_strdup_printf ("file:%s", priv->res_arg + 4); g_free (priv->res_arg); priv->res_arg = newuri; + name = g_path_get_basename (newuri + 5); + for (i = 0; i < G_N_ELEMENTS (man_suffixes); i++) { + if (is_man_path (name, man_suffixes[i])) { + if (man_suffixes[i]) + name[strlen (name) - strlen (man_suffixes[i]) - 1] = '\0'; + break; + } + } + priv->docuri = g_strdup ("man:"); + priv->fulluri = g_strconcat ("man:", name, NULL); + priv->page_id = name; resolve_file_uri (uri); } else { |