summaryrefslogtreecommitdiff
path: root/uri.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2006-11-06 08:54:18 +0000
committerDaniel Veillard <veillard@src.gnome.org>2006-11-06 08:54:18 +0000
commit481dcfcff3945620a05b8cdbc2f3c7aa5de7a470 (patch)
treea760b42ec662948852b775cc2953fff810784dfc /uri.c
parentfcd18ff8f753dd7308b619476266f1a2ddcc8859 (diff)
downloadlibxml2-481dcfcff3945620a05b8cdbc2f3c7aa5de7a470.tar.gz
applied patch from Igor for path conversion on Windows Daniel
* uri.c: applied patch from Igor for path conversion on Windows Daniel
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/uri.c b/uri.c
index 1e292237..b95e091b 100644
--- a/uri.c
+++ b/uri.c
@@ -2473,6 +2473,24 @@ xmlPathToURI(const xmlChar *path)
cal = xmlCanonicPath(path);
if (cal == NULL)
return(NULL);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?)
+ If 'cal' is a valid URI allready then we are done here, as continuing would make
+ it invalid. */
+ if ((uri = xmlParseURI((const char *) cal)) != NULL) {
+ xmlFreeURI(uri);
+ return cal;
+ }
+ /* 'cal' can contain a relative path with backslashes. If that is processed
+ by xmlSaveURI, they will be escaped and the external entity loader machinery
+ will fail. So convert them to slashes. Misuse 'ret' for walking. */
+ ret = cal;
+ while (*ret != '\0') {
+ if (*ret == '\\')
+ *ret = '/';
+ ret++;
+ }
+#endif
memset(&temp, 0, sizeof(temp));
temp.path = (char *) cal;
ret = xmlSaveUri(&temp);