@@ -336,18 +336,17 @@ tl::expected<std::string, errors> url_pattern_init::process_pathname(
336336
337337tl::expected<std::string, errors> url_pattern_init::process_search (
338338 std::string_view value, process_type type) {
339- // Let strippedValue be the given value with a single leading U+003F (?)
340- // removed, if any.
341- if (value.starts_with (" ?" )) {
342- value.remove_prefix (1 );
343- }
344- // We cannot assert that the value is no longer starting with a single
345- // question mark because technically it can start. The question is whether or
346- // not we should remove the first question mark. Ref:
347- // https://github.com/ada-url/ada/pull/992 The spec is not clear on this.
348-
349339 // If type is "pattern" then return strippedValue.
350340 if (type == process_type::pattern) {
341+ // Let strippedValue be the given value with a single leading U+003F (?)
342+ // removed, if any.
343+ if (value.starts_with (" ?" )) {
344+ value.remove_prefix (1 );
345+ }
346+ // We cannot assert that the value is no longer starting with a single
347+ // question mark because technically it can start. The question is whether
348+ // or not we should remove the first question mark. Ref:
349+ // https://github.com/ada-url/ada/pull/992 The spec is not clear on this.
351350 return std::string (value);
352351 }
353352 // Return the result of running canonicalize a search given strippedValue.
@@ -356,14 +355,13 @@ tl::expected<std::string, errors> url_pattern_init::process_search(
356355
357356tl::expected<std::string, errors> url_pattern_init::process_hash (
358357 std::string_view value, process_type type) {
359- // Let strippedValue be the given value with a single leading U+0023 (#)
360- // removed, if any.
361- if (value.starts_with (" #" )) {
362- value.remove_prefix (1 );
363- }
364- ADA_ASSERT_TRUE (!value.starts_with (" #" ));
365358 // If type is "pattern" then return strippedValue.
366359 if (type == process_type::pattern) {
360+ // Let strippedValue be the given value with a single leading U+0023 (#)
361+ // removed, if any.
362+ if (value.starts_with (" #" )) {
363+ value.remove_prefix (1 );
364+ }
367365 return std::string (value);
368366 }
369367 // Return the result of running canonicalize a hash given strippedValue.
0 commit comments