HomeAssistant: cleanse uri

This commit is contained in:
andig 2026-01-19 08:48:06 +01:00
parent ddffc8a6d5
commit d3d902ebd8
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@ func NewConnection(log *util.Logger, uri, home string) (*Connection, error) {
Helper: request.NewHelper(log),
instance: &proxyInstance{
home: home,
uri: uri,
uri: util.DefaultScheme(strings.TrimSuffix(uri, "/"), "http"),
},
}

View file

@ -31,7 +31,7 @@ func getInstances(w http.ResponseWriter, req *http.Request) {
}
func getEntities(w http.ResponseWriter, req *http.Request) {
uri := req.URL.Query().Get("uri")
uri := util.DefaultScheme(strings.TrimSuffix(req.URL.Query().Get("uri"), "/"), "http")
if uri == "" {
jsonError(w, http.StatusBadRequest, errors.New("missing uri"))
return