aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 75ce62e22..2bc72979d 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