Skip to content

Commit

Permalink
[api] fix crash when product defines remote update url
Browse files Browse the repository at this point in the history
We get an empty hash with current XMLHash which leads to an activerecord
exception meanhwile.
  • Loading branch information
adrianschroeter committed Jan 31, 2022
1 parent 81737d1 commit d02b397
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/api/app/models/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,16 @@ def _update_from_xml_register_update(rxml)
update[key] = pu
end
u.elements('repository') do |repo|
update_repo = Repository.find_by_project_and_name(repo.get('project'), repo.get('name'))
project = repo.get('project')
name = repo.get('name')
next if project.blank? || name.blank? # might be already defined via external url

update_repo = Repository.find_by_project_and_name(project, name)
next unless update_repo # it might be a remote repo, which will not become indexed

arch = repo.get('arch')
key = update_repo.id.to_s
p = { product: self, repository: update_repo }
arch = repo.get('arch')
if arch.present?
key += "/#{arch}"
arch_filter = Architecture.find_by_name(arch)
Expand Down

0 comments on commit d02b397

Please sign in to comment.