Skip to content

Commit 1f09b29

Browse files
committed
fix: .
1 parent c251430 commit 1f09b29

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/services/api/multipart.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,17 @@ export class MultipartAPI extends BaseYdbAPI {
8484
try {
8585
console.log('Parsing chunk, part length:', part.length);
8686

87-
// Split headers and body using double newline as separator
88-
const [_headers, ...bodyParts] = part.split('\n\n');
89-
if (!bodyParts.length) {
87+
// Normalize line endings and split headers and body
88+
const normalizedPart = part.replace(/\r\n/g, '\n');
89+
const sections = normalizedPart.split('\n\n');
90+
91+
if (sections.length < 2) {
9092
console.log('Invalid chunk format: no body found');
9193
return null;
9294
}
9395

94-
// Get the body (join with newlines in case the body contains newlines)
95-
const body = bodyParts.join('\n\n').trim();
96+
// Get the body (last section after headers)
97+
const body = sections[sections.length - 1].trim();
9698
if (!body) {
9799
console.log('Invalid chunk format: empty body');
98100
return null;

0 commit comments

Comments
 (0)