diff options
author | Dave Beckett <dave@dajobe.org> | 2013-11-24 13:52:35 -0800 |
---|---|---|
committer | Dave Beckett <dave@dajobe.org> | 2013-11-24 13:52:35 -0800 |
commit | 742666d3356daef50e6cf28c03594b0d7b4dc645 (patch) | |
tree | f2351da1a388b1bb5217d47e5127dafd3451bafc /src/raptor_uri.c | |
parent | 3fcd12c3186ecfe0a9ac1cb1b5cd085e4c297495 (diff) | |
download | raptor-742666d3356daef50e6cf28c03594b0d7b4dc645.tar.gz |
Normalize file URIs
(raptor_uri_filename_to_uri_string): Use raptor_uri_normalize_path to
normalize the resulting URI
Diffstat (limited to 'src/raptor_uri.c')
-rw-r--r-- | src/raptor_uri.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/raptor_uri.c b/src/raptor_uri.c index 169a6988..7ebf96e6 100644 --- a/src/raptor_uri.c +++ b/src/raptor_uri.c @@ -653,8 +653,9 @@ raptor_uri_filename_to_uri_string(const char *filename) #ifndef WIN32 char *path = NULL; #endif - /* "file://" ... \0 */ - size_t len = 7 + 1; + /* "file://" */ +#define RAPTOR_LEN_FILE_CSS 7 + size_t len = RAPTOR_LEN_FILE_CSS; if(!filename) return NULL; @@ -727,7 +728,7 @@ raptor_uri_filename_to_uri_string(const char *filename) len += 2; /* strlen(%xx)-1 */ } - buffer = RAPTOR_MALLOC(unsigned char*, len); + buffer = RAPTOR_MALLOC(unsigned char*, len + 1); if(!buffer) goto path_done; @@ -764,6 +765,10 @@ raptor_uri_filename_to_uri_string(const char *filename) path_done: #ifndef WIN32 + /* Normalize the resulting URI path after the "file://" */ + raptor_uri_normalize_path(buffer + RAPTOR_LEN_FILE_CSS, + len - RAPTOR_LEN_FILE_CSS); + if(path) free(path); #endif |