[devhelp] link: Properly convert filename to URI



commit d0fbaf159e0571d8f78472be0332b2985f22f21b
Author: Arnel A. Borja <kyoushuu yahoo com>
Date:   Sun May 19 00:02:16 2013 +0800

    link: Properly convert filename to URI
    
    Use g_filename_to_uri to convert filename to URI instead of just adding file://
    to the start of the filename.

 src/dh-link.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-link.c b/src/dh-link.c
index 444668a..f503471 100644
--- a/src/dh-link.c
+++ b/src/dh-link.c
@@ -227,14 +227,16 @@ dh_link_get_book_id (DhLink *link)
 gchar *
 dh_link_get_uri (DhLink *link)
 {
-       gchar *base, *uri;
+       gchar *base, *filename, *uri;
 
         if (link->type == DH_LINK_TYPE_BOOK)
                 base = link->base;
         else
                 base = link->book->base;
 
-       uri = g_strconcat ("file://", base, "/", link->filename, NULL, NULL);
+       filename = g_build_filename (base, link->filename, NULL);
+       uri = g_filename_to_uri (filename, NULL, NULL);
+       g_free (filename);
 
        return uri;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]