ufo
ufo copied to clipboard
Only apply trailing slash utilities to supported protocols
Extracted from #175
Utilities for trailing slash (withTrailingSlash) operate on URIs that have a meaning for trailing slash. http, https, (perhaps rsync, ftp and custom protocols are included)
However there are protocols like data:, mailto:, blob:, etc do not expect a trailing slash to be added or removed from the end.
Having a check (for invalid or invalid list of protocols) is costly on runtime and also not maintainable. One solution would be to support new options to both opt-in and also configure the list which is against costly.
I am mainly thinking of differentiating based on proto: and proto:/ proto:// to do this automatically. (it still needs a new option to opt out btw)
Hello,
We discussed protocols before in #70. Summary there is a list of known protocols https://en.m.wikipedia.org/wiki/List_of_URI_schemes and an IANA list here https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
Probably I could take care of it next week, hopefully but before would like to make tests with %100 coverage 😄
Thanks!
Thanks for the links dear @divine. I am thinking of a strategy that does not requires a maintainable list btw as we need to keep ufo compact. But finally if no other ways, behind a flag we might use a compiled regex.
I am mainly thinking of differentiating based on
proto:andproto:/proto://to do this automatically. (it still needs a new option to opt out btw)
Might break for some, e.g.:
aaa://-> no trailing slash everfacetime://-> no trailing slash evercvs://-> no trailing slash after ; (if ; is set)dict://-> no trailing slash at the end evergizmoproject://-> no trailing slash ever