fix: allow non-Stringer using %v format (unsafe but does the job)

This commit is contained in:
xdrm-brackets 2021-05-18 16:24:31 +02:00
parent 346cc4e557
commit 2a17ba2f72
No known key found for this signature in database
GPG Key ID: 99F952DD5DE2439E
1 changed files with 5 additions and 7 deletions

View File

@ -59,13 +59,11 @@ func (s Handler) resolve(w http.ResponseWriter, r *http.Request) {
for b, perm := range list {
scope[a][b] = perm
for name, value := range input.Data {
if stringer, ok := value.(fmt.Stringer); ok {
scope[a][b] = strings.ReplaceAll(
scope[a][b],
fmt.Sprintf("[%s]", name),
fmt.Sprintf("[%s]", stringer),
)
}
scope[a][b] = strings.ReplaceAll(
scope[a][b],
fmt.Sprintf("[%s]", name),
fmt.Sprintf("[%v]", value),
)
}
}
}