go-domain-util
go-domain-util copied to clipboard
Fix for medium.com urls with @ in the path
Thanks for the awesome utility :clap:!
Currently the site medium uses urls like medium.com/@user/article example. Currently an empty string is returned by Domain() for all of them.
I just swapped the order of the removing the path portion with the removing the piece before the @. This way handles both the weird medium urls with an @ in the path and the user:pass@... urls.
My change messed up the nice alignment in util_test.go on one of the test data sections. On go version go1.13.4 running gofmt domainutil/util_test.go doesn't align the TestStripURLParts map. If this is an issue I can try to manually align it!