Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compat with newer Psych: Use safe_load with permitted_classes Poll and TimePollHead #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion atom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _(string)
require_relative "poll"
Dir.chdir(olddir)

poll = YAML::load_file("data.yaml")
poll = YAML::safe_load_file("data.yaml", permitted_classes: [Poll, TimePollHead])

feed.title = poll.name
feed.id = "urn:dudle:#{poll.class}:#{poll.name}"
Expand Down
2 changes: 1 addition & 1 deletion dudle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def initialize(params = {:revision => nil, :title => nil, :hide_lang_chooser =>
File.open("last_read_access","w").close unless @cgi.user_agent =~ $conf.bots
@basedir = ".."
inittabs
@table = YAML::load(VCS.cat(self.revision, "data.yaml"))
@table = YAML::safe_load(VCS.cat(self.revision, "data.yaml"), permitted_classes: [Poll, TimePollHead])
@urlsuffix = File.basename(File.expand_path("."))
@title = @table.name

Expand Down
4 changes: 2 additions & 2 deletions timepollhead.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def delete_column(column)

def parsecolumntitle(title)
if $cgi.include?("add_remove_column_day")
parsed_date = YAML::load(Time.parse("#{$cgi["add_remove_column_month"]}-#{$cgi["add_remove_column_day"]} #{title}").to_yaml)
parsed_date = YAML::safe_load(Time.parse("#{$cgi["add_remove_column_month"]}-#{$cgi["add_remove_column_day"]} #{title}").to_yaml, permitted_classes: [Poll, TimePollHead])
else
earlytime = @head.keys.collect{|t|t.strftime("%H:%M")}.sort[0]
parsed_date = YAML::load(Time.parse("#{$cgi["add_remove_column_month"]}-#{title} #{earlytime}").to_yaml)
parsed_date = YAML::safe_load(Time.parse("#{$cgi["add_remove_column_month"]}-#{title} #{earlytime}").to_yaml, permitted_classes: [Poll, TimePollHead])
end
parsed_date
end
Expand Down