diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index 773913ffc33eed62d2cc14cabf854dfc859f59f3..64a099c8a42e3c673b89b3348936c0e4050d6174 100644 (file)
SPDocument *
GdkpixbufInput::open(Inkscape::Extension::Input */*mod*/, char const *uri)
{
- SPDocument *doc = sp_document_new(NULL, TRUE, TRUE);
+ SPDocument *doc = NULL;
GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL );
if (pb) { /* We are readable */
+ doc = sp_document_new(NULL, TRUE, TRUE);
bool saved = sp_document_get_undo_sensitive(doc);
sp_document_set_undo_sensitive(doc, false); // no need to undo in this temporary document
// 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.