diff options
| author | Jack Nagel | 2014-01-10 17:32:15 -0600 |
|---|---|---|
| committer | Jack Nagel | 2014-01-10 17:32:15 -0600 |
| commit | c41fa02b2d3d80001dc3851e3534e5496661c99c (patch) | |
| tree | e2afa53fe0983c66d8de40129bd959d7cefefe95 /Library/Homebrew/utils.rb | |
| parent | deefbcf3e6567b32a2973f7ee2773b9109d0f65a (diff) | |
| download | homebrew-c41fa02b2d3d80001dc3851e3534e5496661c99c.tar.bz2 | |
Escape issue search string
Fixes #25779.
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 11 |
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 |
