Skip to content

Commit

Permalink
Merge pull request #9 from ontoportal-lirmm/development
Browse files Browse the repository at this point in the history
Fix: replace URI.escape with CGI.escape
  • Loading branch information
syphax-bouazzouni authored May 4, 2023
2 parents fe929a4 + 0c8cd2b commit 7b298ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/link_explorer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def replace_template_elements(url, values = [])
return url if values.nil? || values.empty?
values = values.dup
values = [values] unless values.is_a?(Array)
escaped_value = URI.escape(values.shift, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
escaped_value = CGI.escape(values.shift)
if url.match(/(\{.*?\})/)
url.gsub(/(\{.*?\})/) do
escaped_value
Expand Down
6 changes: 3 additions & 3 deletions lib/ontologies_api_client/models/class.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "uri"
require "cgi"
require_relative "../base"

module LinkedData
Expand Down Expand Up @@ -47,7 +47,7 @@ def purl
return "" if self.links.nil?
return self.id if self.id.include?("purl.")
ont = self.explore.ontology
"#{LinkedData::Client.settings.purl_prefix}/#{ont.acronym}?conceptid=#{URI.escape(self.id, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}"
"#{LinkedData::Client.settings.purl_prefix}/#{ont.acronym}?conceptid=#{CGI.escape(self.id)}"
end

def ontology
Expand All @@ -56,7 +56,7 @@ def ontology

def self.find(id, ontology, params = {})
ontology = HTTP.get(ontology, params)
ontology.explore.class(URI.escape(id, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")))
ontology.explore.class(CGI.escape(id))
end

def self.search(*args)
Expand Down
6 changes: 3 additions & 3 deletions lib/ontologies_api_client/models/mapping.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "uri"
require "cgi"
require_relative "../base"

module LinkedData
Expand All @@ -11,11 +11,11 @@ class Mapping < LinkedData::Client::Base
@media_type = "http://data.bioontology.org/metadata/Mapping"

def self.find(id, params = {})
HTTP.get(mappings_url_prefix + URI.escape(id, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")), params)
HTTP.get(mappings_url_prefix + CGI.escape(id), params)
end

def delete
HTTP.delete(mappings_url_prefix + URI.escape(self.id, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")))
HTTP.delete(mappings_url_prefix + CGI.escape(self.id))
end

private
Expand Down

0 comments on commit 7b298ff

Please sign in to comment.