Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix handling of four-slash file: URIs
GnuCash creates reports in HTML, then (since 2.6) hands them off to a
WebKitWebView for viewing with a URI of file:///%s. The third slash
is added for compatibility with Win32, where it represents the system
root ("My Computer") and, for the purposes of URIs, C: (or the archaic
C|) is seen as a top-level directory thereof.
On *NIX systems, the filename already includes a leading slash (e.g.
/tmp/gnc-report-RANDOM.html), so the result is four leading slashes,
the first two of which are dropped, leaving what Cygwin sees as a UNC
address. However, this is an incorrect assumption in this case, as a
file: URI (just like other protocols) is officially of the form
file://hostname/path, with hostname being optional when referring to the
local system, hence the customary three leading slashes. So a UNC URI
would have only two leading slashes, and anything more than three should
be treated simply as extras.- Loading branch information
Showing
with
15 additions
and 1 deletion.
- +13 −0 2.38.2-gconvert-cygwin.patch
- +2 −1 glib2.0.cygport
| @@ -0,0 +1,13 @@ | ||
| --- origsrc/glib-2.38.2/glib/gconvert.c 2014-04-02 01:48:25.505447200 -0500 | ||
| +++ src/glib-2.38.2/glib/gconvert.c 2014-04-02 02:22:47.959345500 -0500 | ||
| @@ -1583,7 +1583,9 @@ g_filename_from_uri (const gchar *uri, | ||
| return NULL; | ||
| } | ||
|
|
||
| - if (has_case_prefix (path_part, "///")) | ||
| + if (has_case_prefix (path_part, "////")) | ||
| + path_part += 1; | ||
| + else if (has_case_prefix (path_part, "///")) | ||
| path_part += 2; | ||
| else if (has_case_prefix (path_part, "//")) | ||
| { |