You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/06/01 19:06:16 UTC
[whimsy] branch master updated: Safety first
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 8216791 Safety first
8216791 is described below
commit 8216791d251ae5ae604f7c0c9c18f971e65b5935
Author: Sebb <se...@apache.org>
AuthorDate: Mon Jun 1 20:06:02 2020 +0100
Safety first
---
lib/whimsy/asf/yaml.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/whimsy/asf/yaml.rb b/lib/whimsy/asf/yaml.rb
index 143a3d6..a117626 100644
--- a/lib/whimsy/asf/yaml.rb
+++ b/lib/whimsy/asf/yaml.rb
@@ -16,7 +16,7 @@ module YamlFile
def self.update(yaml_file)
File.open(yaml_file, File::RDWR|File::CREAT, 0644) do |file|
file.flock(File::LOCK_EX)
- yaml = YAML.load(file.read) || {} rescue {}
+ yaml = YAML.safe_load(file.read) || {} rescue {}
yield yaml
file.rewind
file.write YAML.dump(yaml)
@@ -32,7 +32,7 @@ module YamlFile
def self.read(yaml_file)
File.open(yaml_file, File::RDONLY) do |file|
file.flock(File::LOCK_SH)
- yaml = YAML.load(file.read) || {} rescue {}
+ yaml = YAML.safe_load(file.read) || {} rescue {}
if block_given?
yield yaml
else