summaryrefslogtreecommitdiff
path: root/lib/helper.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-02-21 13:52:00 +0100
committermguetlein <martin.guetlein@gmail.com>2011-02-21 13:52:00 +0100
commit80d49f60ac55cc2fb1c7974752e1e947fa3f3f70 (patch)
tree73ffdbcebfab9debc1dd17284fe6623f245a479e /lib/helper.rb
parent1bac8bd64f9f703d7e20a65da0ffb05cb150e90f (diff)
clean uri now works for https, rdf parsing issues: /features and ?feature_uris, missing subjectid
Diffstat (limited to 'lib/helper.rb')
-rw-r--r--lib/helper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/helper.rb b/lib/helper.rb
index a1590d7..b30908c 100644
--- a/lib/helper.rb
+++ b/lib/helper.rb
@@ -32,8 +32,9 @@ helpers do
uri = uri[0,uri.index("InChI=")] if uri.index("InChI=")
out = URI.parse(uri)
- out.path = out.path[0, out.path.length - (out.path.reverse.rindex(/\/{1}\d+\/{1}/))] if out.path.index(/\/{1}\d+\/{1}/) #cuts after /id/ for a&a
- "#{out.scheme}:" + (out.port != 80 ? out.port : "") + "//#{out.host}#{out.path.chomp('/')}"
+ out.path = out.path[0, out.path.length - (out.path.reverse.rindex(/\/{1}\d+\/{1}/))] if out.path.index(/\/{1}\d+\/{1}/) #cuts after /id/ for a&a
+ port = (out.scheme=="http" && out.port==80)||(out.scheme=="https" && out.port==443) ? "" : ":#{out.port.to_s}"
+ "#{out.scheme}://#{out.host}#{port}#{out.path.chomp("/")}" #"
end
#unprotected uri for login