diff options
Diffstat (limited to 'lib/helper.rb')
-rw-r--r-- | lib/helper.rb | 5 |
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 |