summaryrefslogtreecommitdiff
path: root/lib/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-02-23 17:49:02 +0100
committerChristoph Helma <helma@in-silico.de>2010-02-23 17:49:02 +0100
commit7b59d1f07bf8cf0e23f3070f97f940af3bfad843 (patch)
treec74673fea079496b6ac5576662f3d6649d1028f2 /lib/compound.rb
parent66af8a8f648c41321189800cd81246f28d046fe6 (diff)
some test issues resolved
Diffstat (limited to 'lib/compound.rb')
-rw-r--r--lib/compound.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index 56646c0..0ee853d 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -17,7 +17,8 @@ module OpenTox
@inchi = sdf2inchi(params[:sdf])
@uri = File.join(@@config[:services]["opentox-compound"],URI.escape(@inchi))
elsif params[:name]
- @inchi = RestClient.get("#{@@cactus_uri}#{params[:name]}/stdinchi").chomp
+ # paranoid URI encoding to keep SMILES charges and brackets
+ @inchi = RestClient.get("#{@@cactus_uri}#{URI.encode(params[:name], Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}/stdinchi").chomp
@uri = File.join(@@config[:services]["opentox-compound"],URI.escape(@inchi))
elsif params[:uri]
@uri = params[:uri]