From 112313cf4ab051acc1589260cc6a6460aad82b1b Mon Sep 17 00:00:00 2001 From: Jan Orel Date: Sun, 4 Aug 2024 22:04:04 +0200 Subject: [PATCH] B #-: Oncfg: make empty YAML load backward comp. (#3192) --- src/onecfg/lib/config/type/yaml.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/onecfg/lib/config/type/yaml.rb b/src/onecfg/lib/config/type/yaml.rb index 74875aaa8b..3385766e16 100644 --- a/src/onecfg/lib/config/type/yaml.rb +++ b/src/onecfg/lib/config/type/yaml.rb @@ -43,6 +43,10 @@ module OneCfg::Config::Type if Gem::Version.new(Psych.const_get(:VERSION)) >= Gem::Version.new('4.0') @content = YAML.load_file(name, :aliases => true) + + # for backward compatibility with older Psych return `false` + # instead of `nil` if the file was empty + @content = false if @content.nil? else @content = YAML.load_file(name) end