Merge remote branch 'bigbash/280-bug-fix'
This commit is contained in:
commit
d66c1e70bc
3 changed files with 9 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ class RequestsController < ApplicationController
|
||||||
aspect = current_user.aspect_by_id(params[:request][:aspect_id])
|
aspect = current_user.aspect_by_id(params[:request][:aspect_id])
|
||||||
|
|
||||||
begin
|
begin
|
||||||
rel_hash = relationship_flow(params[:request][:destination_url])
|
rel_hash = relationship_flow(params[:request][:destination_url].strip!)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
raise e unless e.message.include? "not found"
|
raise e unless e.message.include? "not found"
|
||||||
flash[:error] = I18n.t 'requests.create.error'
|
flash[:error] = I18n.t 'requests.create.error'
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class Request
|
||||||
protected
|
protected
|
||||||
def clean_link
|
def clean_link
|
||||||
if self.destination_url
|
if self.destination_url
|
||||||
|
self.destination_url = self.destination_url.strip
|
||||||
self.destination_url = 'http://' + self.destination_url unless self.destination_url.match('https?://')
|
self.destination_url = 'http://' + self.destination_url unless self.destination_url.match('https?://')
|
||||||
self.destination_url = self.destination_url + '/' if self.destination_url[-1,1] != '/'
|
self.destination_url = self.destination_url + '/' if self.destination_url[-1,1] != '/'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,11 @@ describe Request do
|
||||||
Request.for_user(user).all.count.should == 1
|
Request.for_user(user).all.count.should == 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should strip the destination url' do
|
||||||
|
person_request = Request.new
|
||||||
|
person_request.destination_url = " http://google.com/ "
|
||||||
|
person_request.send(:clean_link)
|
||||||
|
person_request.destination_url.should == "http://google.com/"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue