From bcb34494fe93d057210bc7e4048da66ce455c953 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 3 Mar 2014 11:31:09 +0100 Subject: Don't try to load JPG and PNG files with createChildDoc(). (bzr r13099) --- src/uri-references.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index ea8078b28..5cdf132fa 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -56,8 +56,19 @@ void URIReference::attach(const URI &uri) throw(BadURIException) document = _owner_document; } + // createChildDoc() assumes that the referenced file is an SVG. + // PNG and JPG files are allowed (in the case of feImage). + gchar *filename = uri.toString(); + bool skip = false; + if( g_str_has_suffix( filename, ".jpg" ) || + g_str_has_suffix( filename, ".JPG" ) || + g_str_has_suffix( filename, ".png" ) || + g_str_has_suffix( filename, ".PNG" ) ) { + skip = true; + } + // The path contains references to seperate document files to load. - if(document && uri.getPath()) { + if(document && uri.getPath() && !skip ) { std::string base = document->getBase() ? document->getBase() : ""; std::string path = uri.getFullPath(base); if(!path.empty()) @@ -66,9 +77,10 @@ void URIReference::attach(const URI &uri) throw(BadURIException) document = NULL; } if(!document) { - g_warning("Can't get document for referenced URI: %s", uri.toString()); + g_warning("Can't get document for referenced URI: %s", filename); return; } + g_free( filename ); gchar const *fragment = uri.getFragment(); if ( !uri.isRelative() || uri.getQuery() || !fragment ) { -- cgit v1.2.3