Format and validate connection url on /api/connect endpoint
This commit is contained in:
8
api.go
8
api.go
@@ -79,6 +79,14 @@ func API_Connect(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts := Options{Url: url}
|
||||||
|
url, err := formatConnectionUrl(opts)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
client, err := NewClientFromUrl(url)
|
client, err := NewClientFromUrl(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(400, Error{err.Error()})
|
c.JSON(400, Error{err.Error()})
|
||||||
|
|||||||
Reference in New Issue
Block a user