From e629a9bf7108435e34c77ee1b7f340903ee59968 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 19 Feb 2016 18:09:46 +0800 Subject: [PATCH] fix get_invite_link function. fixes #471 --- app/controllers/application_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 74d56340..8a8d54ea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -64,9 +64,6 @@ private end def get_invite_link - unsafe_uri = request.env["REQUEST_URI"] || 'https://metamaps.cc' - valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ - safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : '//metamaps.cc/' - @invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "") + @invite_link = "#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : "") end end