there is no logic you can use to determine if close brace after a URL with no space are not part of teh URL. that's not a bug in the code that's a bug in the spec. braces should never have been permitted as valid URL characters but we are so far past the point where it has become common.