File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -529,9 +529,9 @@ export class Parser {
529529 }
530530
531531 if ( this . indent >= map . indent ) {
532+ const atMapIndent = ! this . onKeyLine && this . indent === map . indent
532533 const atNextItem =
533- ! this . onKeyLine &&
534- this . indent === map . indent &&
534+ atMapIndent &&
535535 ( it . sep || it . explicitKey ) &&
536536 this . type !== 'seq-item-ind'
537537
@@ -673,7 +673,7 @@ export class Parser {
673673 default : {
674674 const bv = this . startBlockValue ( map )
675675 if ( bv ) {
676- if ( atNextItem && bv . type !== 'block-seq' && it . explicitKey ) {
676+ if ( atMapIndent && bv . type !== 'block-seq' ) {
677677 map . items . push ( { start } )
678678 }
679679 this . stack . push ( bv )
Original file line number Diff line number Diff line change @@ -422,6 +422,16 @@ describe('odd indentations', () => {
422422 const doc = YAML . parseDocument < YAML . YAMLMap , false > ( '?\n!!null' )
423423 expect ( doc . errors ) . not . toHaveLength ( 0 )
424424 } )
425+
426+ test ( 'unindented block scalar header in mapping value (#553)' , ( ) => {
427+ const doc = YAML . parseDocument < YAML . YAMLMap , false > ( 'a:\n|\n x' )
428+ expect ( doc . errors ) . not . toHaveLength ( 0 )
429+ } )
430+
431+ test ( 'unindented flow collection in mapping value' , ( ) => {
432+ const doc = YAML . parseDocument < YAML . YAMLMap , false > ( 'a:\n{x}' )
433+ expect ( doc . errors ) . not . toHaveLength ( 0 )
434+ } )
425435} )
426436
427437describe ( 'Excessive entity expansion attacks' , ( ) => {
You can’t perform that action at this time.
0 commit comments