File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments