Skip to content

Fix handling of four-slash file: URIs in Cygwin

LRN requested to merge lrn/glib:cygwin-slash into master

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.

Merge request reports