Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2022-10-31 02:43:50 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2022-10-31 03:45:13 +0300
commit8334eeeeff869b2de4457cf5004e490a01542d44 (patch)
tree0bc4b25dfa8135c81cb2bd890f6d9e80f127259b /app
parent6bdf6f03b4f0dec3e5545ae88584ef82da4c1a84 (diff)
Ensure pod urls are always lowercase
otherwise pods can exist multiple times with mixed case
Diffstat (limited to 'app')
-rw-r--r--app/models/pod.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/pod.rb b/app/models/pod.rb
index ff61af5b3..0f3177c2b 100644
--- a/app/models/pod.rb
+++ b/app/models/pod.rb
@@ -58,7 +58,7 @@ class Pod < ApplicationRecord
def find_or_create_by(opts) # Rename this method to not override an AR method
uri = URI.parse(opts.fetch(:url))
port = DEFAULT_PORTS.include?(uri.port) ? DEFAULT_PORT : uri.port
- find_or_initialize_by(host: uri.host, port: port).tap do |pod|
+ find_or_initialize_by(host: uri.host.downcase, port: port).tap do |pod|
pod.ssl ||= (uri.scheme == "https")
pod.save
end
@@ -168,6 +168,6 @@ class Pod < ApplicationRecord
def not_own_pod
pod_uri = AppConfig.pod_uri
pod_port = DEFAULT_PORTS.include?(pod_uri.port) ? DEFAULT_PORT : pod_uri.port
- errors.add(:base, "own pod not allowed") if pod_uri.host == host && pod_port == port
+ errors.add(:base, "own pod not allowed") if pod_uri.host.downcase == host && pod_port == port
end
end