From 45355035967a754a86969015d588c45ce269bd89 Mon Sep 17 00:00:00 2001 From: hahnlee Date: Thu, 16 May 2024 17:10:12 +0900 Subject: [PATCH] =?UTF-8?q?fix(parser):=20=EC=97=AC=EB=9F=AC=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=EC=98=B5=EC=85=98=20=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/parser/src/models/doc-info/border-fill.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/parser/src/models/doc-info/border-fill.ts b/packages/parser/src/models/doc-info/border-fill.ts index 4117ec3..43c7a77 100644 --- a/packages/parser/src/models/doc-info/border-fill.ts +++ b/packages/parser/src/models/doc-info/border-fill.ts @@ -236,11 +236,11 @@ export function mapFill(reader: ByteReader): Fill { } return { kind } case FillKind.Color: - return { kind, content: ColorFill.fromReader(reader) } as const + return { kind, content: ColorFill.fromReader(reader, false) } as const case FillKind.Image: return { kind, content: ImageFill.fromReader(reader) } as const case FillKind.Gradation: - return { kind, content: GradationFill.fromReader(reader) } + return { kind, content: GradationFill.fromReader(reader, false) } default: throw new Error(`Unknown fill kind: ${kind}`) } @@ -276,7 +276,7 @@ export class ColorFill { public alpha: number, ) {} - static fromReader(reader: ByteReader) { + static fromReader(reader: ByteReader, checkEof: boolean = true) { const backgroundColor = ColorRef.fromBits(reader.readUInt32()) const patternColor = ColorRef.fromBits(reader.readUInt32()) const patternKind = mapPatternKind(reader.readInt32() + 1) @@ -287,7 +287,7 @@ export class ColorFill { throw new Error('DocInfo: ColorFill: Additional info is not zero') } - if (!reader.isEOF()) { + if (checkEof && !reader.isEOF()) { throw new Error('DocInfo: ColorFill: Reader is not EOF') } @@ -341,7 +341,7 @@ export class GradationFill { public alpha: number, ) {} - static fromReader(reader: ByteReader) { + static fromReader(reader: ByteReader, checkEof = true) { const kind = mapGradationKind(reader.readUInt8()) const angle = reader.readUInt32() const centerX = reader.readUInt32() @@ -365,7 +365,7 @@ export class GradationFill { const stepCenter = reader.readUInt8() const alpha = reader.readUInt8() - if (!reader.isEOF()) { + if (checkEof && !reader.isEOF()) { throw new Error('DocInfo: GradationFill: Reader is not EOF') }