Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,13 +902,6 @@ function readBlockScalar(state, nodeIndent) {
continue;
}

// Zero-indentation block scalar is not allowed.
// If textIndent is still 0 at this point, it means no explicit indentation
// indicator was given and no indentation was detected in content lines.
if (!detectedIndent && textIndent === 0) {
throwError(state, 'missing indentation for block scalar');
}

// End of the scalar.
if (state.lineIndent < textIndent) {

Expand Down
4 changes: 2 additions & 2 deletions test/issues/0144.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';


var assert = require('assert');
var yaml = require('../../');


it('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () {
// Block scalar with zero indentation should throw an error (issue #280)
assert.throws(() => yaml.load('--- |\nfoo\n'), /missing indentation for block scalar/);
assert.strictEqual(yaml.load('--- |\nfoo\n'), 'foo\n');
});