diff options
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/atari/file.c | 2 | ||||
-rw-r--r-- | frontends/riscos/gui.c | 35 |
2 files changed, 20 insertions, 17 deletions
diff --git a/frontends/atari/file.c b/frontends/atari/file.c index 3816e476d..235d8240f 100644 --- a/frontends/atari/file.c +++ b/frontends/atari/file.c @@ -193,7 +193,7 @@ static nserror atari_path_to_nsurl(const char *path, struct nsurl **url_out) } /* escape the path so it can be placed in a url */ - ret = url_escape(path, 0, false, "/", &escpath); + ret = url_escape(path, false, "/", &escpath); if (ret != NSERROR_OK) { return ret; } diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c index 72eeb6282..7c5216462 100644 --- a/frontends/riscos/gui.c +++ b/frontends/riscos/gui.c @@ -1405,7 +1405,7 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) int spare; char *canonical_path; /* canonicalised RISC OS path */ char *unix_path; /* unix path */ - char *escurl; + char *escaped_path; os_error *error; nserror ret; int urllen; @@ -1443,31 +1443,34 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) } free(canonical_path); - /* convert the unix path into a url */ - urllen = strlen(unix_path) + FILE_SCHEME_PREFIX_LEN + 1; + /* url escape the unix path */ + ret = url_escape(unix_path, false, "/", &escaped_path); + if (ret != NSERROR_OK) { + free(unix_path); + return ret; + } + free(unix_path); + + /* convert the escaped unix path into a url */ + urllen = strlen(escaped_path) + FILE_SCHEME_PREFIX_LEN + 1; url = malloc(urllen); if (url == NULL) { LOG("Unable to allocate url"); - free(unix_path); + free(escaped_path); return NSERROR_NOMEM; } - if (*unix_path == '/') { - snprintf(url, urllen, "%s%s", FILE_SCHEME_PREFIX, unix_path + 1); + if (*escaped_path == '/') { + snprintf(url, urllen, "%s%s", + FILE_SCHEME_PREFIX, escaped_path + 1); } else { - snprintf(url, urllen, "%s%s", FILE_SCHEME_PREFIX, unix_path); + snprintf(url, urllen, "%s%s", + FILE_SCHEME_PREFIX, escaped_path); } - free(unix_path); + free(escaped_path); - /* We don't want '/' to be escaped. */ - ret = url_escape(url, FILE_SCHEME_PREFIX_LEN, false, "/", &escurl); + ret = nsurl_create(url, url_out); free(url); - if (ret != NSERROR_OK) { - return ret; - } - - ret = nsurl_create(escurl, url_out); - free(escurl); return ret; } |