FIX: Handle missing git repo details in plugin list (#24539)

Followup to e37fb3042d6f56a27a01614e57bc7029f472b0c9,
in some cases we cannot get git information for the
plugin folder (e.g. permission issues), so we need
to only try and get information about it if
commit_hash is present.
This commit is contained in:
Martin Brennan
2023-11-24 12:08:10 +10:00
committed by GitHub
parent d667c22171
commit 09c446c1ae
2 changed files with 8 additions and 1 deletions

View File

@ -519,8 +519,9 @@ class Plugin::Instance
end
def discourse_owned?
return false if commit_hash.blank?
parsed_commit_url = UrlHelper.relaxed_parse(self.commit_url)
return false if !parsed_commit_url
return false if parsed_commit_url.blank?
github_org = parsed_commit_url.path.split("/")[1]
(github_org == "discourse" || github_org == "discourse-org") &&
parsed_commit_url.host == "github.com"