summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-05-09 10:38:58 +0000
committerChristoph Helma <helma@in-silico.ch>2012-05-09 10:38:58 +0000
commitcedd0acd4aa79d147cc1d6335ef7a02845b6e3d1 (patch)
treef08548a0aea687c53591ba64e8d15442df4ea517
parent3f27c9e7d918a4a8ef7fd77eb9042d84e85b4fa5 (diff)
authorization adjusted for uuid uris
-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 92bc865..11d8ae8 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