Strip any trailing slash when saving server URL

This commit is contained in:
Gabe Kangas 2022-01-20 17:07:15 -08:00
parent a471707a54
commit 7f41b2df7c
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA

View File

@ -391,7 +391,16 @@ func SetServerURL(w http.ResponseWriter, r *http.Request) {
return
}
if err := data.SetServerURL(configValue.Value.(string)); err != nil {
rawValue, ok := configValue.Value.(string)
if !ok {
controllers.WriteSimpleResponse(w, false, "server url value invalid")
return
}
// Trim any trailing slash
serverURL := strings.TrimRight(rawValue, "/")
if err := data.SetServerURL(serverURL); err != nil {
controllers.WriteSimpleResponse(w, false, err.Error())
return
}