about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-01-26 16:42:38 -0600
committerStarfall <us@starfall.systems>2021-01-26 16:42:38 -0600
commit3ef928029d94a2b3c6abf96a2935de85c4eed6c8 (patch)
treed8697b527a0a42e51634b1fef68f0162fe2ccbe2 /config/initializers
parent65263e6309fb4dea1a93d4b4806af629d317c156 (diff)
parent52ff3ca675ecac0ff32990b6321fb5e349e6dc59 (diff)
Merge remote-tracking branch 'glitchsoc/main' into main
Diffstat (limited to 'config/initializers')
-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|