Fix GitHub search behaviour change

Handle the case where paths are now returned with preceding `/`.
This commit is contained in:
Mike McQuaid 2020-12-18 13:21:06 +00:00
parent 4067b4d929
commit 48c0c673f8
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -312,7 +312,14 @@ module GitHub
end
def search_code(**qualifiers)
search("code", **qualifiers)
matches = search("code", **qualifiers)
return matches if matches.blank?
matches.map do |match|
# .sub workaround for GitHub returning preceding /
match["path"] = match["path"].sub(%r{^/}, "")
match
end
end
def issues_for_formula(name, tap: CoreTap.instance, tap_full_name: tap.full_name, state: nil)