diff --git a/src/workerd/jsg/url.c++ b/src/workerd/jsg/url.c++ index bbb34e0e806..c55380322ce 100644 --- a/src/workerd/jsg/url.c++ +++ b/src/workerd/jsg/url.c++ @@ -2056,6 +2056,9 @@ UrlPattern::Result UrlPattern::processInit( chooseStr(kj::mv(init.protocol), options.protocol).map([](kj::String&& str) mutable { // It's silly but the URL spec always includes the : suffix in the value, // while the URLPattern spec always omits it. Silly specs. + if (!str.size()) { + return kj::mv(str); + } return stripSuffixFromProtocol(str.asPtr()); })) { result.protocol = kj::mv(protocol);