27 lines
458 B
Go
27 lines
458 B
Go
package directadmin
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
func resolveParams(src string) (map[string][]string, error) {
|
|
dst := map[string][]string{}
|
|
|
|
for _, pair := range strings.Split(src, "&") {
|
|
key, val, ok := strings.Cut(pair, "=")
|
|
if ok {
|
|
if _, ok := dst[key]; !ok {
|
|
dst[key] = []string{}
|
|
}
|
|
unesc, err := url.QueryUnescape(val)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
dst[key] = append(dst[key], unesc)
|
|
}
|
|
}
|
|
|
|
return dst, nil
|
|
}
|