summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-05-07 18:36:46 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-05-07 18:36:46 +0000
commitb4bfb6b581035b52a193c74ac74825f3652a014a (patch)
tree5cb102d4869ab473f9c8fa2e7844079b623ca5da /lib
parent9ef1cdd375793b05d9ef7a6036678168f2704750 (diff)
downloadredmine-b4bfb6b581035b52a193c74ac74825f3652a014a.tar.gz
redmine-b4bfb6b581035b52a193c74ac74825f3652a014a.zip
Replaces use of Digest::MD5 / Digest::SHA1 with ActiveSupport::Digest (#35217).
Patch by Jens Krämer (@jkraemer). git-svn-id: https://svn.redmine.org/redmine/trunk@22816 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/wiki_formatting.rb3
-rw-r--r--lib/redmine/wiki_formatting/section_helper.rb4
-rw-r--r--lib/redmine/wiki_formatting/textile/formatter.rb2
3 files changed, 3 insertions, 6 deletions
diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb
index 3486c74c6..cc68e9972 100644
--- a/lib/redmine/wiki_formatting.rb
+++ b/lib/redmine/wiki_formatting.rb
@@ -18,7 +18,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require_relative 'wiki_formatting/textile/redcloth3'
-require 'digest/md5'
module Redmine
module WikiFormatting
@@ -110,7 +109,7 @@ module Redmine
# Returns a cache key for the given text +format+, +text+, +object+ and +attribute+ or nil if no caching should be done
def cache_key_for(format, text, object, attribute)
if object && attribute && !object.new_record? && format.present?
- "formatted_text/#{format}/#{object.class.model_name.cache_key}/#{object.id}-#{attribute}-#{Digest::MD5.hexdigest text}"
+ "formatted_text/#{format}/#{object.class.model_name.cache_key}/#{object.id}-#{attribute}-#{ActiveSupport::Digest.hexdigest text}"
end
end
diff --git a/lib/redmine/wiki_formatting/section_helper.rb b/lib/redmine/wiki_formatting/section_helper.rb
index 9221d990d..6f53a3f8e 100644
--- a/lib/redmine/wiki_formatting/section_helper.rb
+++ b/lib/redmine/wiki_formatting/section_helper.rb
@@ -22,13 +22,13 @@ module Redmine
module SectionHelper
def get_section(index)
section = extract_sections(index)[1]
- hash = Digest::MD5.hexdigest(section)
+ hash = ActiveSupport::Digest.hexdigest(section)
return section, hash
end
def update_section(index, update, hash=nil)
t = extract_sections(index)
- if hash.present? && hash != Digest::MD5.hexdigest(t[1])
+ if hash.present? && hash != ActiveSupport::Digest.hexdigest(t[1])
raise Redmine::WikiFormatting::StaleSectionError
end
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb
index 1cacfeed6..35684a6c7 100644
--- a/lib/redmine/wiki_formatting/textile/formatter.rb
+++ b/lib/redmine/wiki_formatting/textile/formatter.rb
@@ -17,8 +17,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'digest/md5'
-
module Redmine
module WikiFormatting
module Textile