From f0e5dc234c1660a02bd95f0f3868f74a2e10efb8 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 17 Nov 2023 15:22:21 -0800 Subject: [PATCH] check existance of acroym before fetching details fixes #129 --- controllers/ontologies_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/ontologies_controller.rb b/controllers/ontologies_controller.rb index fc15d567..18ec14c5 100644 --- a/controllers/ontologies_controller.rb +++ b/controllers/ontologies_controller.rb @@ -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?