default value if no request.env in application controller passes the rspec test woot. Only 80 more tests to implement
This commit is contained in:
parent
a93473f2c9
commit
4dbff85443
1 changed files with 2 additions and 2 deletions
|
@ -58,9 +58,9 @@ private
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_invite_link
|
def get_invite_link
|
||||||
unsafe_uri = request.env["REQUEST_URI"]
|
unsafe_uri = request.env["REQUEST_URI"] || 'http://metamaps.cc'
|
||||||
valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/
|
valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/
|
||||||
safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/"
|
safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : 'http://metamaps.cc/'
|
||||||
@invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "")
|
@invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue