about summary refs log tree commit diff
path: root/app/controllers/xrd_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/xrd_controller.rb')
-rw-r--r--app/controllers/xrd_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/xrd_controller.rb b/app/controllers/xrd_controller.rb
index 6fda75a03..417d4f4fa 100644
--- a/app/controllers/xrd_controller.rb
+++ b/app/controllers/xrd_controller.rb
@@ -19,7 +19,12 @@ class XrdController < ApplicationController
   end
 
   def username_from_resource
-    params[:resource].split('@').first.gsub('acct:', '')
+    if params[:resource].start_with?('acct:')
+      params[:resource].split('@').first.gsub('acct:', '')
+    else
+      url = Addressable::URI.parse(params[:resource])
+      url.path.gsub('/users/', '')
+    end
   end
 
   def pem_to_magic_key(public_key)