Skip to content

Commit

Permalink
load safely
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Jun 5, 2024
1 parent f5606cc commit 93bad57
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/prepare_feedback.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require './_plugins/util'
require 'yaml'
require 'csv'

Expand Down Expand Up @@ -37,12 +38,12 @@ def lookup_tuto(topic_id, tuto_id)

file = "topics/#{topic_id}/tutorials/#{tuto_id}/tutorial.md"
if File.exist? file
data = YAML.load_file(file)
data = safe_load_yaml(file)
@cache[key] = data['title']
else
file = "topics/#{topic_id}/tutorials/#{tuto_id}/slides.html"
if File.exist? file
data = YAML.load_file(file)
data = safe_load_yaml(file)
@cache[key] = data['title']
else
puts "No file for #{topic_id}/#{tuto_id}"
Expand All @@ -57,7 +58,7 @@ def lookup_topic(topic_id)
file = "metadata/#{topic_id}.yaml"
return nil unless File.exist? file

data = YAML.load_file(file)
data = safe_load_yaml(file)
@cache[key] = data['title']
end
end
Expand Down

0 comments on commit 93bad57

Please sign in to comment.