summaryrefslogtreecommitdiff
path: root/lib/authorization-helper.rb
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2012-05-10 09:36:01 +0200
committerrautenberg <rautenberg@in-silico.ch>2012-05-10 09:36:01 +0200
commitca0ac867535d38c0f6e59332b85c8da6f23f372d (patch)
tree01021be1437190889b61507c2b66adc0b5fe5d2a /lib/authorization-helper.rb
parente523a4bda0507d3e0b17e50e39e873b0c92d3239 (diff)
parentc7822fc4c461ab6d10649a5964ecb10f7f4c54d7 (diff)
Merge branch 'development' of github.com:opentox/opentox-server into development
Diffstat (limited to 'lib/authorization-helper.rb')
-rw-r--r--lib/authorization-helper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/authorization-helper.rb b/lib/authorization-helper.rb
index 4b534a5..46834c6 100644
--- a/lib/authorization-helper.rb
+++ b/lib/authorization-helper.rb
@@ -78,7 +78,8 @@ module OpenTox
uri = uri.sub(" ", "%20") #dirty hacks => to fix
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.path = out.path[0, out.path.length - (out.path.reverse.rindex(/\/{1}\d+\/{1}/))] if out.path.index(/\/{1}\d+\/{1}/) #cuts after numeric /id/ for a&a
+ out.path.sub! /(\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}).*/, '\1' # cut after uuid
out.path = out.path.split('.').first #cut extension
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("/")}" #"
@@ -128,4 +129,4 @@ module OpenTox
end
end
end
-end \ No newline at end of file
+end