summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--uri.c18
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a0b7f40b..1249ca16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Nov 6 09:56:41 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+ * uri.c: applied patch from Igor for path conversion on Windows
+
Thu Nov 2 11:29:17 CET 2006 Daniel Veillard <daniel@veillard.com>
* xmlregexp.c: another small change on the algorithm for the
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);