[yelp/webkit] Always use the file:// for URIs representing local files



commit 6e5edaaf7600b09a45286772b79f6cefb343c150
Author: Gustavo Noronha Silva <gns gnome org>
Date:   Sun Jul 19 12:32:19 2009 +0100

    Always use the file:// for URIs representing local files
    
    WebKit really wants well-formed URIs, so when setting the base_uri for
    YelpHtml objects, make sure paths get file:// appended.

 src/yelp-html.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/yelp-html.c b/src/yelp-html.c
index 42c2745..744182d 100644
--- a/src/yelp-html.c
+++ b/src/yelp-html.c
@@ -79,7 +79,6 @@ html_open_uri (WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest*
 
     real_uri = g_strdup (uri);
 
-    
     if (!html->priv->frames_enabled) {
   	g_signal_emit (html, signals[URI_SELECTED], 0, real_uri, FALSE);
   	resp = WEBKIT_NAVIGATION_RESPONSE_IGNORE;
@@ -271,7 +270,10 @@ yelp_html_set_base_uri (YelpHtml *html, const gchar *uri)
     if (priv->base_uri)
 	g_free (priv->base_uri);
 
-    priv->base_uri = g_strdup (uri);
+    if (uri[0] == '/')
+	priv->base_uri = g_strdup_printf ("file://%s", uri);
+    else
+	priv->base_uri = g_strdup (uri);
 }
 
 void



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