Code

Kludge for URI resolution of combining paths. Fixes bug #437927.
authorjoncruz <joncruz@users.sourceforge.net>
Tue, 29 Sep 2009 21:10:10 +0000 (21:10 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Tue, 29 Sep 2009 21:10:10 +0000 (21:10 +0000)
src/color-profile.cpp

index 9b05aaa7efdd3f8d52c39445e5e59be89ebc57ef..4b13073165b088e5b208e44e60c9b42ae6566bfb 100644 (file)
@@ -272,14 +272,17 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value )
                         // Normal for files that have not yet been saved.
                         docbase = "";
                     }
+
+                    gchar* escaped = g_uri_escape_string(cprof->href, "!*'();:@=+$,/?#[]", TRUE);
+
                     //g_message("docbase:%s\n", docbase);
                     org::w3c::dom::URI docUri(docbase);
                     //# 2. Get href of icc file.  we don't care if it's rel or abs
-                    org::w3c::dom::URI hrefUri(cprof->href);
+                    org::w3c::dom::URI hrefUri(escaped);
                     //# 3.  Resolve the href according the docBase.  This follows
                     //      the w3c specs.  All absolute and relative issues are considered
                     org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri);
-                    gchar* fullname = g_strdup((gchar *)cprofUri.getNativePath().c_str());
+                    gchar* fullname = g_uri_unescape_string(cprofUri.getNativePath().c_str(), "");
                     cprof->_clearProfile();
                     cprof->profHandle = cmsOpenProfileFromFile( fullname, "r" );
                     if ( cprof->profHandle ) {
@@ -289,6 +292,8 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value )
 #ifdef DEBUG_LCMS
                     DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->profHandle );
 #endif // DEBUG_LCMS
+                    g_free(escaped);
+                    escaped = 0;
                     g_free(fullname);
 #endif // ENABLE_LCMS
                 }