summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-03-27 12:11:16 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2017-03-27 12:11:16 +0100
commit372df59f28c61ff18542693af4a52382f7ba5e7a (patch)
tree50e18ecf437eb0438fcb887164d9be32cbbe2781
parent465ad9f0ab7a4a7325efce446de1de8d115ef2b7 (diff)
downloadnetsurf-372df59f28c61ff18542693af4a52382f7ba5e7a.tar.gz
netsurf-372df59f28c61ff18542693af4a52382f7ba5e7a.tar.bz2
nsurl: Set path of "/" for file: URLs with empty path.
-rw-r--r--utils/nsurl/parse.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c
index 293f8268d..453c56523 100644
--- a/utils/nsurl/parse.c
+++ b/utils/nsurl/parse.c
@@ -952,9 +952,13 @@ static nserror nsurl__create_from_section(const char * const url_s,
&url->path) != lwc_error_ok) {
return NSERROR_NOMEM;
}
- } else if (url->host != NULL &&
- url->scheme_type != NSURL_SCHEME_MAILTO) {
- /* Set empty path to "/", if there's a host */
+ } else if ((url->host != NULL &&
+ url->scheme_type != NSURL_SCHEME_MAILTO) ||
+ url->scheme_type == NSURL_SCHEME_FILE) {
+ /* Set empty path to "/" if:
+ * - there's a host and its not a mailto: URL
+ * - its a file: URL
+ */
if (lwc_intern_string("/", SLEN("/"),
&url->path) != lwc_error_ok) {
return NSERROR_NOMEM;