Skip to content

Commit

Permalink
Escape issue search string
Browse files Browse the repository at this point in the history
  • Loading branch information
jacknagel committed Jan 10, 2014
1 parent deefbcf commit c41fa02
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,19 @@ def open url, headers={}, &block
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
Expand Down

0 comments on commit c41fa02

Please sign in to comment.