From 23cc12cee3fb9fccdad8553afdddf044ebc0ed0f Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 21 Feb 2023 15:50:28 -0500 Subject: [PATCH] fix: update no_scheme to exit properly --- src/parser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser.cpp b/src/parser.cpp index fde7f2d1f..2f6f2faaf 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -126,7 +126,8 @@ namespace ada::parser { case ada::state::NO_SCHEME: { ada_log("NO_SCHEME ", helpers::substring(url_data, input_position)); // If base is null, or base has an opaque path and c is not U+0023 (#), validation error, return failure. - if (base_url == nullptr || (base_url->has_opaque_path && (input_position != input_size))) { + // SCHEME state updates the state to NO_SCHEME and validates url_data is not empty. + if (base_url == nullptr || (base_url->has_opaque_path && url_data[input_position] != '#')) { ada_log("NO_SCHEME validation error"); url.is_valid = false; return url;