diff options
| author | zousar <[email protected]> | 2025-04-11 00:25:20 -0600 |
|---|---|---|
| committer | zousar <[email protected]> | 2025-04-11 00:25:20 -0600 |
| commit | afda5c6345f4c0b274ae8084bfbd371169791c57 (patch) | |
| tree | ded3572c961377625cb516ed5b8374d2e2cbd99c /src/zenserver/frontend/html/pages/entry.js | |
| parent | 5.6.5 (diff) | |
| download | zen-afda5c6345f4c0b274ae8084bfbd371169791c57.tar.xz zen-afda5c6345f4c0b274ae8084bfbd371169791c57.zip | |
Avoid signed overflow using BigInt
Bias for use of BigInt when consuming integer fields in compact binary to avoid values showing up as negative due to overflow on the Number type.
Diffstat (limited to 'src/zenserver/frontend/html/pages/entry.js')
| -rw-r--r-- | src/zenserver/frontend/html/pages/entry.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/zenserver/frontend/html/pages/entry.js b/src/zenserver/frontend/html/pages/entry.js index f127cb0a3..41fc47218 100644 --- a/src/zenserver/frontend/html/pages/entry.js +++ b/src/zenserver/frontend/html/pages/entry.js @@ -210,8 +210,11 @@ export class Page extends ZenPage _display_unsupported(section, entry) { + const replacer = (key, value) => + typeof value === "bigint" ? { $bigint: value.toString() } : value; + const object = entry.to_js_object(); - const text = JSON.stringify(object, null, " "); + const text = JSON.stringify(object, replacer, " "); section.tag("pre").text(text); } |