go-domain-util icon indicating copy to clipboard operation
go-domain-util copied to clipboard

Fix for medium.com urls with @ in the path

Open tomasre opened this issue 5 years ago • 0 comments

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!

tomasre avatar Mar 08 '20 04:03 tomasre