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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user