mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 08:52:21 +00:00
* fix: preserve complete skill artifacts * test: align artifact metadata expectations * fix: harden complete skill artifact handling * fix: close complete artifact review gaps * fix: preserve legacy skill file metadata hints * fix: close artifact presentation review gaps * fix(cli): preserve legacy skill file collector export * refactor: centralize artifact upload helpers * fix: preserve artifact scan and publish bounds * fix: scan complete published text artifacts * fix: harden artifact download presentation * test: avoid secret-like fixture text * refactor: preview artifacts by content * chore(deps): patch transitive audit advisories
14 lines
356 B
TypeScript
14 lines
356 B
TypeScript
import { decodeUtf8Text } from "clawhub-schema";
|
|
|
|
export function decodeBoundedUtf8Text(bytes: Uint8Array, maxBytes: number) {
|
|
if (bytes.byteLength <= maxBytes) return decodeUtf8Text(bytes);
|
|
|
|
try {
|
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(0, maxBytes), {
|
|
stream: true,
|
|
});
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|