summaryrefslogtreecommitdiff
path: root/uri.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2008-03-25 13:22:41 +0000
committerDaniel Veillard <veillard@src.gnome.org>2008-03-25 13:22:41 +0000
commite54c3173b85d2d7eb90fb3b95d96dc761018c15b (patch)
treea3183478167e0700f9be331952bf25fcadcdd621 /uri.c
parent8bf64aef50fe0e969f3b0ac3cd3f58c53fd5c4ff (diff)
downloadlibxml2-e54c3173b85d2d7eb90fb3b95d96dc761018c15b.tar.gz
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
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c24
1 files changed, 24 insertions, 0 deletions
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;