Skip to content

Commit

Permalink
check existance of acroym before fetching details
Browse files Browse the repository at this point in the history
fixes #129
  • Loading branch information
alexskr committed Nov 17, 2023
1 parent 4da3786 commit f0e5dc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class OntologiesController < ApplicationController
get '/:acronym/download' do
acronym = params["acronym"]
ont = Ontology.find(acronym).include(Ontology.goo_attrs_to_load).first
ont.bring(:viewingRestriction) if ont.bring?(:viewingRestriction)
error 422, "You must provide an existing `acronym` to download" if ont.nil?
ont.bring(:viewingRestriction) if ont.bring?(:viewingRestriction)
check_access(ont)
restricted_download = LinkedData::OntologiesAPI.settings.restrict_download.include?(acronym)
error 403, "License restrictions on download for #{acronym}" if restricted_download && !current_user.admin?
Expand Down

0 comments on commit f0e5dc2

Please sign in to comment.