From 3d901dd93c6db9cac4d930271cd3db33126118eb Mon Sep 17 00:00:00 2001 From: joncruz Date: Tue, 29 Sep 2009 21:10:10 +0000 Subject: [PATCH] Kludge for URI resolution of combining paths. Fixes bug #437927. --- src/color-profile.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 9b05aaa7e..4b1307316 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -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 } -- 2.30.2