From 465ad9f0ab7a4a7325efce446de1de8d115ef2b7 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 27 Mar 2017 12:09:45 +0100 Subject: [PATCH] nsurl: Add detection of "file:" URL schemes. --- utils/nsurl/parse.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c index 89a10d244..293f8268d 100644 --- a/utils/nsurl/parse.c +++ b/utils/nsurl/parse.c @@ -270,6 +270,16 @@ static void nsurl__get_string_markers(const char * const url_s, (*(pos - off + 4) == 'S')))) { marker.scheme_type = NSURL_SCHEME_HTTPS; is_http = true; + } else if (off == SLEN("file") && + (((*(pos - off + 0) == 'f') || + (*(pos - off + 0) == 'F')) && + ((*(pos - off + 1) == 'i') || + (*(pos - off + 1) == 'I')) && + ((*(pos - off + 2) == 'l') || + (*(pos - off + 2) == 'L')) && + ((*(pos - off + 3) == 'e') || + (*(pos - off + 3) == 'E')))) { + marker.scheme_type = NSURL_SCHEME_FILE; } else if (off == SLEN("ftp") && (((*(pos - off + 0) == 'f') || (*(pos - off + 0) == 'F')) &&