diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 75ce62e221..2bc72979df 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -277,10 +277,19 @@ module GitHub extend self end 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) } 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 # 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