Parsing a url like scheme:/.//path internally removes the ./ in the serialization (per the spec), so parsing the serialized URL of scheme://path yields a URL that is parsed differently than the original one (ie. path is treated as a host now, instead of part of the URL's path).
Cases to consider:
scheme:/.//path
scheme:/..//path
scheme:/./..//path (any leading mixed collection of ./ and ../)
My reading of the spec is that this might be a shortcoming that needs to be addressed there, rather than just an implementation bug. I can envision a couple possible solutions:
- don't truncate
./ or ../ if it's the first component of a path, avoiding the issue entirely
- truncate
/ when the previous segment is empty (resulting in scheme:/path)