mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-13 15:28:37 +01:00
allow invalid utf8 characters when marshalizing json responses
This commit is contained in:
1 parent
50f5f83ace
commit
756b326bfa
9 files changed
+57
-20
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package picker
|
||||
|
||||
import (
|
||||
"encoding/json/jsontext"
|
||||
"encoding/json/v2"
|
||||
"strings"
|
||||
|
||||
@@ -29,9 +30,12 @@ func Pick(data any, rawFields string) (any, error) {
|
||||
// implementations are invoked, and then convert it back to a plain
|
||||
// json value that we can further operate on.
|
||||
//
|
||||
// Note that invalid UTF8 characters are mangled for compatibility
|
||||
// with earlier versions and to prevent unnecessery causing an error.
|
||||
//
|
||||
// @todo research other approaches to avoid the double serialization
|
||||
// ---
|
||||
encoded, err := json.Marshal(data)
|
||||
encoded, err := json.Marshal(data, jsontext.AllowInvalidUTF8(true))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user