MCPcopy
hub / github.com/larksuite/cli / formatFormFieldValue

Function formatFormFieldValue

internal/cmdutil/fileupload.go:150–155  ·  view source on GitHub ↗

formatFormFieldValue renders a JSON-unmarshalled value as a multipart form field string. float64 is handled specially: fmt's default %v/%g switches to scientific notation for values >= ~1e6 (e.g. "1.185356e+06"), which some backends reject when parsing the field as an integer. Use decimal notation i

(v any)

Source from the content-addressed store, hash-verified

148// instead so size / block_num / offset-style numeric fields round-trip cleanly.
149// All other types fall through to %v.
150func formatFormFieldValue(v any) string {
151 if n, ok := v.(float64); ok {
152 return strconv.FormatFloat(n, 'f', -1, 64)
153 }
154 return fmt.Sprintf("%v", v)
155}

Callers 2

BuildFormdataFunction · 0.85
TestFormatFormFieldValueFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatFormFieldValueFunction · 0.68