about summary refs log tree commit diff
path: root/app/models/account.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-08-20 14:26:14 +0200
committerGitHub <noreply@github.com>2021-08-20 14:26:14 +0200
commit65b003cab86b6837012f4562d3d9d0910f3e942e (patch)
tree5d63d6f54c327bb3b0feecae7019a7fcd2e0cd9f /app/models/account.rb
parent4a364de500029676b9828ec596ed6c2a09cfb65c (diff)
parent4f074b68ba4b9b91a7989f3f7d64ab29cf42214c (diff)
Merge pull request #1588 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index ab3cac0d6..2cfa77615 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -58,8 +58,9 @@ class Account < ApplicationRecord
     hub_url
   )
 
-  USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i
-  MENTION_RE  = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[a-z0-9]+)?)/i
+  USERNAME_RE   = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i
+  MENTION_RE    = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[a-z0-9]+)?)/i
+  URL_PREFIX_RE = /\Ahttp(s?):\/\/[^\/]+/
 
   include AccountAssociations
   include AccountAvatar
@@ -381,7 +382,7 @@ class Account < ApplicationRecord
   def synchronization_uri_prefix
     return 'local' if local?
 
-    @synchronization_uri_prefix ||= uri[/http(s?):\/\/[^\/]+\//]
+    @synchronization_uri_prefix ||= "#{uri[URL_PREFIX_RE]}/"
   end
 
   class Field < ActiveModelSerializers::Model