Escape issue search string

Fixes Homebrew/homebrew#25779.
This commit is contained in:
Jack Nagel 2014-01-10 17:32:15 -06:00
parent ed613bb2f3
commit 0d42601872

View File

@ -277,10 +277,19 @@ module GitHub extend self
end end
def each_issue_matching(query, &block) def each_issue_matching(query, &block)
uri = ISSUES_URI + query uri = ISSUES_URI + uri_escape(query)
open(uri) { |f| Utils::JSON.load(f.read)['issues'].each(&block) } open(uri) { |f| Utils::JSON.load(f.read)['issues'].each(&block) }
end end
def uri_escape(query)
if URI.respond_to?(:encode_www_form_component)
URI.encode_www_form_component(query)
else
require "erb"
ERB::Util.url_encode(query)
end
end
def issues_for_formula name def issues_for_formula name
# bit basic as depends on the issue at github having the exact name of the # bit basic as depends on the issue at github having the exact name of the
# formula in it. Which for stuff like objective-caml is unlikely. So we # formula in it. Which for stuff like objective-caml is unlikely. So we