From 4e3fefe39274424c14c12cd93016fdf495e7cc08 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Mon, 23 Oct 2017 17:07:14 +0200 Subject: Refs #4762 Add file extension checking before importing (standard app and api) --- app/controllers/api/v1/imports_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/controllers/api') diff --git a/app/controllers/api/v1/imports_controller.rb b/app/controllers/api/v1/imports_controller.rb index 6050418d8..197e23337 100644 --- a/app/controllers/api/v1/imports_controller.rb +++ b/app/controllers/api/v1/imports_controller.rb @@ -5,7 +5,12 @@ class Api::V1::ImportsController < Api::V1::IbooController def create args = workbench_import_params.merge(creator: 'Webservice') @import = parent.workbench_imports.create(args) - create! + if @import.valid? + create! + else + binding.pry + render json: { status: "error", messages: @import.errors.full_messages } + end end private -- cgit v1.2.3