File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -374,7 +374,8 @@ registerScriptlet(trustedJsonEditFetchResponse, {
374374
375375function jsonlEditFn ( jsonp , text = '' ) {
376376 const safe = safeSelf ( ) ;
377- const linesBefore = text . split ( / \n + / ) ;
377+ const lineSeparator = / \r ? \n / . exec ( text ) ?. [ 0 ] || '\n' ;
378+ const linesBefore = text . split ( lineSeparator ) ;
378379 const linesAfter = [ ] ;
379380 for ( const lineBefore of linesBefore ) {
380381 let obj ;
@@ -387,9 +388,10 @@ function jsonlEditFn(jsonp, text = '') {
387388 linesAfter . push ( lineBefore ) ;
388389 continue ;
389390 }
390- linesAfter . push ( JSONPath . toJSON ( obj , safe . JSON_stringify ) ) ;
391+ const lineAfter = safe . JSON_stringify ( obj ) ;
392+ linesAfter . push ( lineAfter ) ;
391393 }
392- return linesAfter . join ( '\n' ) ;
394+ return linesAfter . join ( lineSeparator ) ;
393395}
394396registerScriptlet ( jsonlEditFn , {
395397 name : 'jsonl-edit.fn' ,
You can’t perform that action at this time.
0 commit comments