From 9996738a477270310b6d7e6303a65aecfa4dcec7 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Wed, 27 May 2026 06:21:31 +0300 Subject: [PATCH] =?UTF-8?q?Revert=20"fix=20&=20test:=20throw=20error=20on?= =?UTF-8?q?=20zero-indentation=20block=20scalar=20(close=20#280)=E2=80=A6"?= =?UTF-8?q?=20(#751)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3d7d34aeb2bc27dc386dc5ace6d5600c5ac1d67a. --- lib/loader.js | 7 ------- test/issues/0144.js | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/loader.js b/lib/loader.js index 692b1d3d..25abc808 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -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) { diff --git a/test/issues/0144.js b/test/issues/0144.js index 1abc90c9..4abfb6a9 100644 --- a/test/issues/0144.js +++ b/test/issues/0144.js @@ -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'); });