diff --git a/src/util.c b/src/util.c index 7a1a4f30..f8aeff8e 100644 --- a/src/util.c +++ b/src/util.c @@ -348,6 +348,9 @@ char *util_url_unescape (const char *src) */ char *util_normalise_uri(const char *uri) { char *path; +#ifdef _WIN32 + size_t len; +#endif if(uri[0] != '/') return NULL; @@ -359,6 +362,12 @@ char *util_normalise_uri(const char *uri) { return NULL; } +#ifdef _WIN32 + /* If we are on Windows, strip trailing dots, as Win API strips it anyway */ + for (len = strlen(path); len > 0 && path[len-1] == '.'; len--) + path[len-1] = '\0'; +#endif + /* We now have a full URI-decoded path. Check it for allowability */ if(verify_path(path)) return path;