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:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user