#
# SPDX-License-Identifier: AGPL-3.0
+# When loading YAML, deserialize :foo as ":foo", rather than raising
+# "Psych::DisallowedClass: Tried to load unspecified class: Symbol"
+class Psych::ScalarScanner
+ alias :orig_tokenize :tokenize
+ def tokenize string
+ return string if string =~ /^:[a-zA-Z]/
+ orig_tokenize(string)
+ end
+end
+
module Psych
module Visitors
class YAMLTree < Psych::Visitors::Visitor
'Ki' => 1 << 10,
'M' => 1000000,
'Mi' => 1 << 20,
- "G" => 1000000000,
- "Gi" => 1 << 30,
- "T" => 1000000000000,
- "Ti" => 1 << 40,
- "P" => 1000000000000000,
- "Pi" => 1 << 50,
- "E" => 1000000000000000000,
- "Ei" => 1 << 60,
+ "G" => 1000000000,
+ "Gi" => 1 << 30,
+ "T" => 1000000000000,
+ "Ti" => 1 << 40,
+ "P" => 1000000000000000,
+ "Pi" => 1 << 50,
+ "E" => 1000000000000000000,
+ "Ei" => 1 << 60,
}[mt[2]]
end
end
if erb
yaml = ERB.new(yaml).result(binding)
end
- YAML.load(yaml, deserialize_symbols: false)
+ YAML.safe_load(yaml)
else
{}
end