about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2021-01-26 23:21:32 +0100
committerGitHub <noreply@github.com>2021-01-26 23:21:32 +0100
commit52ff3ca675ecac0ff32990b6321fb5e349e6dc59 (patch)
treeeeeeeead25872b19b34b31e3ccbd543d3e2fd9b8 /config
parentca6c62068e35537251cc650c8b2d03a1a2163d06 (diff)
parent00e55445b9aa5a399a9f8b76e42fde9da2c399fd (diff)
Merge pull request #1491 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'config')
-rw-r--r--config/initializers/open_uri_redirection.rb2
-rw-r--r--config/initializers/rack_attack.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/config/initializers/open_uri_redirection.rb b/config/initializers/open_uri_redirection.rb
index e9de85bdc..0e57c53c6 100644
--- a/config/initializers/open_uri_redirection.rb
+++ b/config/initializers/open_uri_redirection.rb
@@ -3,6 +3,6 @@ require 'open-uri'
 module OpenURI
   def self.redirectable?(uri1, uri2) # :nodoc:
     uri1.scheme.casecmp(uri2.scheme).zero? ||
-      (/\A(?:http|https|ftp)\z/i =~ uri1.scheme && /\A(?:http|https|ftp)\z/i =~ uri2.scheme)
+      (/\A(?:http|https|ftp)\z/i.match?(uri1.scheme) && /\A(?:http|https|ftp)\z/i.match?(uri2.scheme))
   end
 end
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index 6662ef40b..c0db49907 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -78,7 +78,7 @@ class Rack::Attack
   API_DELETE_STATUS_REGEX = /\A\/api\/v1\/statuses\/[\d]+/.freeze
 
   throttle('throttle_api_delete', limit: 30, period: 30.minutes) do |req|
-    req.authenticated_user_id if (req.post? && req.path =~ API_DELETE_REBLOG_REGEX) || (req.delete? && req.path =~ API_DELETE_STATUS_REGEX)
+    req.authenticated_user_id if (req.post? && req.path.match?(API_DELETE_REBLOG_REGEX)) || (req.delete? && req.path.match?(API_DELETE_STATUS_REGEX))
   end
 
   throttle('throttle_sign_up_attempts/ip', limit: 25, period: 5.minutes) do |req|