Color profiles not loaded on Windows

Bug #1644886 reported by jazzynico on 2016-11-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
jazzynico

Bug Description

Reproduced on Windows XP (32-bit) with lp:inkscape/0.92.x rev. 15214.
Not reproduced on Xubuntu 16.04, lp:inkscape/0.92.x rev. 15214 and lp:inkscape rev. 15273.

On Windows XP, the profiles linked to a document are listed in the Documents properties and F&S dialogs, but can't be used. It seems to be due to bug in src/uri.cpp (called from src/color-profile.cpp, ColorProfile::set method).

The document docbase is "C:\Documents and Settings\nicolas\Bureau\SVG\profiletest.svg" and xlink:href="C:\WINDOWS\System32\spool\DRIVERS\COLOR\is330.icm" (only one profile to keep the example as simple as possible).

In ColorProfile::set:
1. "g_uri_escape_string" returns an escaped path for the profile:
"C:%5CWINDOWS%5CSystem32%5Cspool%5CDRIVERS%5CCOLOR%5Cis330.icm".
2. In "URI::from_native_filename", the path is then turned into an uri with "g_filename_to_uri":
"file:///C:/Documents%20and%20Settings/nicolas/Bureau/SVG/profiletest.svg"
and then initialized as an URI object.
3. "URI::getFullPath" is called for the docbase URI object, and itself calls "_impl->getPath()" that returns:
"/C:/Documents and Settings/nicolas/Bureau/SVG/profiletest.svg"
4. "URI::getFullPath" tests the path, and as it's an invalid path, clears it.
5. Another URI object is created for the profile path. "_impl->getPath()" returns:
"\WINDOWS\System32\spool\DRIVERS\COLOR\is330.icm"
Invalid again, the path is clears.
6. "cmsOpenProfileFromFile" tries to open an empty path, and fails, but an empty (and completely useless) color profile is created with a correct name anyways.

Replacing:
gchar* fullname = g_uri_unescape_string(fullpath.c_str(), "");
with:
gchar* fullname = g_uri_unescape_string(escaped, "");
fixes the issue on Windows XP, with profiles linked as absolute path. But of course, it would be better to fix the issue in the URI creation.

jazzynico (jazzynico) wrote :

Another possibility to fix the profile path (but not the docbase). More elegant, but really needs some extra testing.

--- src/color-profile.cpp 2016-06-14 12:33:17 +0000
+++ src/color-profile.cpp 2016-11-25 17:43:52 +0000
@@ -314,7 +314,7 @@
                     //# 1. Get complete URI of document
                     gchar const *docbase = doc->getURI();

- gchar* escaped = g_uri_escape_string(this->href, "!*'();:@=+$,/?#", TRUE);
+ gchar* escaped = g_uri_escape_string(this->href, NULL, TRUE);

                     //g_message("docbase:%s\n", docbase);
                     //org::w3c::dom::URI docUri(docbase);

jazzynico (jazzynico) wrote :

Apparently, removing ":" from the reserved_chars_allowed list seems to work correctly.

The "g_uri_escape_string" part was added when fixing bug #437927 "crash in 'Fill > CMS' tab when linked icc color profile name contains spaces ". Does anyone know why we used such a long list?

Changed in inkscape:
status: New → In Progress
assignee: nobody → jazzynico (jazzynico)
jazzynico (jazzynico) wrote :

Partial fix (from comment #2) tested on Xubuntu 16.04 and applied to lp:inkscape rev. 15277 and lp:inkscape/0.92.x rev. 15223.

jazzynico (jazzynico) on 2017-01-04
Changed in inkscape:
milestone: 0.92 → 0.93
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers