quintex-dev / asterisk-ari-go

This is a new and improved Asterisk ARI client written in Go Lang.
Apache License 2.0
8 stars 4 forks source link

NewConfiguration function has wrong regex #1

Open chrisroy87 opened 2 years ago

chrisroy87 commented 2 years ago

The regex manipulation of BasePath at:

var re = regexp.MustCompile(`\/.*`)
s := re.ReplaceAllString(basePath, `/ari`)

is wrong. It replaces the entire base path with just "/ari".

pdf commented 1 year ago

I don't understand why you'd mangle the input anyway. Just require that users enter the full correct URL - maybe they've put it behind a reverse proxy and the path is not /ari, it's not sensible to overwrite the URL path.

If you really did want to mangle the URL, and there was some very good reason for that, using net/url would be a much more robust way of doing it, rather than using regexp.