nsurl: Set path of "/" for file: URLs with empty path.

This commit is contained in:
Michael Drake 2017-03-27 12:11:16 +01:00
parent 465ad9f0ab
commit 372df59f28
1 changed files with 7 additions and 3 deletions

View File

@ -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;