From 153c740268c1bf6255f14f80550f690179a72fd9 Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 25 May 2011 13:35:42 +0200 Subject: fix if subjectid is nil --- lib/helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/helper.rb b/lib/helper.rb index 3a6126a..995f3e9 100644 --- a/lib/helper.rb +++ b/lib/helper.rb @@ -44,8 +44,9 @@ helpers do def uri_available?(urlStr) url = URI.parse(urlStr) + subjectidstr = @subjectid ? "?subjectid=#{CGI.escape @subjectid}" : "" Net::HTTP.start(url.host, url.port) do |http| - return http.head("#{url.request_uri}?subjectid=#{CGI.escape @subjectid}").code == "200" + return http.head("#{url.request_uri}#{subjectidstr}").code == "200" end end -- cgit v1.2.3