fix(share): require at least 1 byte of content in .infiplot files

Reject header-only files (37 bytes, empty plaintext) at the unpack
boundary instead of letting them through as empty strings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yuanzonghao
2026-06-18 21:56:38 +08:00
parent 64cf9c330d
commit 941b54c3f8
+1 -1
View File
@@ -28,7 +28,7 @@ export async function packDoc(docStr: string): Promise<Uint8Array> {
}
export async function unpackDoc(blob: Uint8Array): Promise<string> {
if (blob.length < HEADER_LEN) {
if (blob.length < HEADER_LEN + 1) {
throw new Error("文件太小,不是合法的分享文件");
}
for (let i = 0; i < MAGIC.length; i++) {