Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #7697 - enable searching by CVE #4836

Merged
merged 1 commit into from Dec 3, 2014
Merged

fixes #7697 - enable searching by CVE #4836

merged 1 commit into from Dec 3, 2014

Conversation

stbenjam
Copy link
Contributor

No description provided.

end

def find_cve
@cve = params[:cve]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably check the id, eg:

def find_cve
  @cve = ErratumCve.find_by_id(params[:cve])
  fail HttpErrors::NotFound, _("Could not find erratum CVE with id '%s'") % params[:cve] unless @cve
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I had that originally, I wasn't sure if it was worth the double SQL query (and cve_id isn't unique), but will add it

@daviddavis
Copy link
Contributor

ACK pending small comment

@stbenjam
Copy link
Contributor Author

@daviddavis Can you just sanity check this? I think I need to do this to verify it, as an errata can have many CVE's, and cve_id is not unique.

def find_cve
   @cve = params[:cve] if ErratumCve.where(:cve_id => params[:cve]).any?
   fail HttpErrors::NotFound, _("Could not find erratum with CVE '%s'") % params[:cve] unless @cve
end

@daviddavis
Copy link
Contributor

Sorry, I didn't realize the cve id wasn't a primary key. In that case I might keep it the way it was before. My bad.

I would probably just remove the find_cve method though. Just use params[:cve] instead of @cve.

@daviddavis daviddavis self-assigned this Dec 1, 2014
@jlsherrill
Copy link
Member

[test]

@daviddavis
Copy link
Contributor

APJ

@stbenjam
Copy link
Contributor Author

stbenjam commented Dec 2, 2014

[test]

1 similar comment
@ehelms
Copy link
Member

ehelms commented Dec 2, 2014

[test]

stbenjam added a commit that referenced this pull request Dec 3, 2014
fixes #7697 - enable searching by CVE
@stbenjam stbenjam merged commit 76c5a0c into Katello:master Dec 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants