From 58ff0f0838df3fa496d7541adff1057002f0037f Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Mon, 2 Dec 2024 16:00:41 -0500 Subject: [PATCH] Ruby 3.x: use URI::DEFAULT_PARSER.unescape instead of URI.unescape (fixes https://github.com/papyri/sosol/issues/351) --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 652d069cf..2361747c2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -161,7 +161,7 @@ def self.stats(user_id) stats = ActiveRecord::Base.connection.execute("select p.id AS pub_id, p.title AS pub_title, p.status AS pub_status, i.title AS id_title, c.comment AS comment, c.reason AS reason, c.created_at AS created_at from comments c LEFT OUTER JOIN publications p ON c.publication_id=p.id LEFT OUTER JOIN identifiers i ON c.identifier_id=i.id where c.user_id=#{user_id} ORDER BY c.created_at;") stats.each do |row| row['created_at'] = DateTime.parse(row['created_at'].to_s) - row['comment'] = URI.unescape(row['comment']).tr('+', ' ') unless row['comment'].nil? + row['comment'] = URI::DEFAULT_PARSER.unescape(row['comment']).tr('+', ' ') unless row['comment'].nil? end end end