From e54c3173b85d2d7eb90fb3b95d96dc761018c15b Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 25 Mar 2008 13:22:41 +0000 Subject: fix saving for file:///X:/ URI embedding Windows file paths should fix * uri.c: fix saving for file:///X:/ URI embedding Windows file paths should fix #524253 Daniel svn path=/trunk/; revision=3714 --- uri.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'uri.c') diff --git a/uri.c b/uri.c index cf3768b7..fafd1125 100644 --- a/uri.c +++ b/uri.c @@ -421,6 +421,30 @@ xmlSaveUri(xmlURIPtr uri) { } if (uri->path != NULL) { p = uri->path; + /* + * the colon in file:///d: should not be escaped or + * Windows accesses fail later. + */ + if ((uri->scheme != NULL) && + (p[0] == '/') && + (((p[1] >= 'a') && (p[1] <= 'z')) || + ((p[1] >= 'A') && (p[1] <= 'Z'))) && + (p[2] == ':') && + (xmlStrEqual(uri->scheme, BAD_CAST "file"))) { + if (len + 3 >= max) { + max *= 2; + ret = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + return(NULL); + } + } + ret[len++] = *p++; + ret[len++] = *p++; + ret[len++] = *p++; + } while (*p != 0) { if (len + 3 >= max) { max *= 2; -- cgit v1.2.1