Code

using uri syntax while importing files using xlink:href
authortheadib <theadib@users.sourceforge.net>
Tue, 5 May 2009 23:19:43 +0000 (23:19 +0000)
committertheadib <theadib@users.sourceforge.net>
Tue, 5 May 2009 23:19:43 +0000 (23:19 +0000)
src/extension/internal/gdkpixbuf-input.cpp

index 773913ffc33eed62d2cc14cabf854dfc859f59f3..0acf1648c6c5d1084efb0eca943724f8cf1bed8a 100644 (file)
@@ -55,7 +55,14 @@ GdkpixbufInput::open(Inkscape::Extension::Input */*mod*/, char const *uri)
         // import as <image>
         repr = xml_doc->createElement("svg:image");
 
-        repr->setAttribute("xlink:href", uri);
+        // convert filename to uri
+        gchar* _uri = g_filename_to_uri(uri, NULL, NULL);
+        if(_uri) {
+            repr->setAttribute("xlink:href", _uri);
+            g_free(_uri);
+        } else {
+            repr->setAttribute("xlink:href", uri);
+        }
         /* impl: doc->base is currently NULL, so we can use uri for href whether it's absolute
          * or relative.  The href will get rewritten by rebase_hrefs if by chance uri is relative
          * and doc gets saved to a different directory.