Skip to content

Commit 30a9c9f

Browse files
committed
simplify component header presence check
1 parent 9c35d3c commit 30a9c9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Component implements Part {
2222
* @param data Component byte representation to parse
2323
*/
2424
public static parse(data: Uint8Array): Component {
25-
const hasHeaders = Multipart.findSequenceIndex(data, Multipart.CRLF) !== 0;
25+
const hasHeaders = !(data[0] === Multipart.CR && data[1] === Multipart.LF);
2626
const headersEndIndex = hasHeaders ? Multipart.findSequenceIndex(data, Multipart.combineArrays([Multipart.CRLF, Multipart.CRLF])) + 2 : 0;
2727

2828
const headersBuffer = data.slice(0, headersEndIndex);

0 commit comments

Comments
 (0)