Skip to content
Permalink
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
yselkowitz committed Apr 2, 2014
1 parent 5024aa0 commit 40ca93c8ae81e7a05ec098246b43ce74e157ebd6
Showing with 15 additions and 1 deletion.
  1. +13 −0 2.38.2-gconvert-cygwin.patch
  2. +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, "//"))
{
@@ -3,7 +3,7 @@ inherit gnome2 python

NAME="glib2.0"
VERSION=2.38.2
RELEASE=1
RELEASE=2
CATEGORY="Libs"
SUMMARY="GNOME core C function library"
DESCRIPTION="GLib is the low-level core library that forms the basis for
@@ -22,6 +22,7 @@ PATCH_URI="
2.34.3-m4macros.patch
2.36.3-visibility.patch
2.36.4-gutf8-cygwin.patch
2.38.2-gconvert-cygwin.patch
"
# 2.36.4-gsocket-cygwin.patch # requires abstract sockets

0 comments on commit 40ca93c

Please sign in to comment.