fix: use newer qson to add support for escaped = (equals) signs

Equal signs should be escaped - %3D - in order to be used in values.
This commit is contained in:
Jose Diaz-Gonzalez
2025-08-12 20:15:27 -04:00
parent 3eeb9be292
commit b0c2912453
25 changed files with 74 additions and 56 deletions

View File

@@ -1,11 +1,11 @@
module github.com/dokku/dokku/plugins/logs
go 1.24.0
go 1.24.5
require (
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0
github.com/fastfishio/qson v1.0.2
github.com/spf13/pflag v1.0.7
)

View File

@@ -2,6 +2,8 @@ github.com/alexellis/go-execute/v2 v2.2.1 h1:4Ye3jiCKQarstODOEmqDSRCqxMHLkC92Bhs
github.com/alexellis/go-execute/v2 v2.2.1/go.mod h1:FMdRnUTiFAmYXcv23txrp3VYZfLo24nMpiIneWgKHTQ=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fastfishio/qson v1.0.2 h1:AY1E9RjVQ9iNPP6G9NQcEXtHXBBq204zUR0tsNFIxFY=
github.com/fastfishio/qson v1.0.2/go.mod h1:QHBKJuWMgwEGYxdK3s1JKiRKwm5VgJx6vU3+kQa/kOU=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
@@ -10,8 +12,6 @@ github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/U
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0 h1:ct2XA1aDw8A07Dr8gtrrZgIgLKcZNAl2o9nn0WRMK4Y=
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0/go.mod h1:DFXrEwSRX0p/aSvxE21319menCBFeQO0jXpRj7LEZUA=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=

View File

@@ -9,7 +9,7 @@ import (
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/joncalhoun/qson"
"github.com/fastfishio/qson"
)
// VectorSink is a map of vector sink properties
@@ -84,36 +84,13 @@ func SinkValueToConfig(appName string, sinkValue string) (VectorSink, error) {
query := u.RawQuery
query = strings.TrimPrefix(query, "&")
// Parse query parameters using Go's standard library instead of qson
// This correctly handles '=' signs in parameter values
values, err := url.ParseQuery(query)
b, err := qson.ToJSON(query)
if err != nil {
return data, err
}
// Convert url.Values to the expected nested map structure
data = make(VectorSink)
for key, valueList := range values {
if len(valueList) > 0 {
// Handle nested keys like "auth[token]" -> {"auth": {"token": "value"}}
if strings.Contains(key, "[") && strings.HasSuffix(key, "]") {
// Parse nested key structure
parts := strings.SplitN(key, "[", 2)
parentKey := parts[0]
childKey := strings.TrimSuffix(parts[1], "]")
// Ensure parent exists as a map
if data[parentKey] == nil {
data[parentKey] = make(map[string]interface{})
}
if parentMap, ok := data[parentKey].(map[string]interface{}); ok {
parentMap[childKey] = valueList[0]
}
} else {
// Simple key-value pair
data[key] = valueList[0]
}
}
if err := json.Unmarshal(b, &data); err != nil {
return data, err
}
data["type"] = u.Scheme