From ee324c054eaf8800584ec6b5d66f01d816957614 Mon Sep 17 00:00:00 2001 From: Jennifer Vendetti Date: Mon, 17 Apr 2023 15:59:37 -0700 Subject: [PATCH] Raise 404 for invalid source or target ontologies Fixes #210 --- app/controllers/mappings_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/mappings_controller.rb b/app/controllers/mappings_controller.rb index 32eb601f8..8fbf16dea 100644 --- a/app/controllers/mappings_controller.rb +++ b/app/controllers/mappings_controller.rb @@ -46,11 +46,14 @@ def count end def show - page = params[:page] || 1 @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:id]).first + not_found if @ontology.nil? + @target_ontology = LinkedData::Client::Models::Ontology.find(params[:target]) - ontologies = [@ontology.acronym, @target_ontology.acronym] + not_found if @target_ontology.nil? + page = params[:page] || 1 + ontologies = [@ontology.acronym, @target_ontology.acronym] @mapping_pages = LinkedData::Client::HTTP.get(MAPPINGS_URL, {page: page, ontologies: ontologies.join(",")}) @mappings = @mapping_pages.collection @delete_mapping_permission = check_delete_mapping_permission(@mappings)