You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v2.1.2: dedicated decode-failure preview, no more sentinel leakage into UI
The decode-failure sentinels INVALID_COMPRESSED_DATA_MESSAGE and
MAX_DECOMPRESSED_SIZE_MESSAGE were never honoured by the consumers --
they leaked through getContent() / getDataUri() into Angular code
viewers, JSON viewers, and base64 data URIs inside <img>/<audio>/<video>
tags. The size-limit sentinel has been there for a long time; the
invalid-data one is new in v2.1.1 -- both have the same downstream
problem.
This commit short-circuits both the parser preview functions to detect
the sentinel and return a clean, dedicated "decode failure" iframe HTML
with two distinct headlines:
- 'Inscription too large to decode' (size-limit)
- 'Inscription content cannot be decoded' (invalid-data)
InscriptionPreviewService.getPreview() does the check at the top, so
backend `/preview/:id` rendering automatically benefits without any
backend code change. getContentTypeInstructions() gains a new
'decode-failure' return shape for the frontend's inline routing
(text/code/json/yaml/css/js paths). The existing else branch in
inscription-viewer.component.html already routes 'decode-failure' to
<app-preview-viewer>, which calls getPreview() -> the new failure HTML.
No frontend component changes needed.
Other changes in this commit:
- Added an exported helper `isDecodeFailureSentinel(content)` for
consumers that want to detect the failure case directly.
- Migrated all `// test here: http://localhost:...` URL comments in
inscription-preview.service.ts to https://ordpool.space/... so they
remain useful for anyone who doesn't have a local dev environment.
Tests: 5 new (sentinel helper coverage + getContentTypeInstructions /
getPreview behavior on the corrupt-brotli fixture, plus a regression
guard that the sentinel string and its base64 don't leak into the
preview HTML).
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "ordpool-parser",
3
-
"version": "2.1.1",
3
+
"version": "2.1.2",
4
4
"description": "Zero-dependency TypeScript parser for Bitcoin digital artifacts: Inscriptions, Runes, BRC-20, SRC-20, CAT-21, Atomicals, and Labitbu. Works in Node.js and browsers.",
? `The decompressed content exceeds the ${MAX_DECOMPRESSED_SIZE/1024/1024} MB safety limit. The data is preserved on chain and remains accessible via the raw content link.`
456
+
: `The inscription declares a brotli or gzip Content-Encoding that doesn't match its actual body. The data is preserved on chain and remains accessible via the raw content link.`;
0 commit comments