From cb717aede235ce1b7b49f7417ec198fe2b4c4ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vantomme?= Date: Wed, 14 Apr 2021 21:56:36 +0200 Subject: [PATCH] Fix (GraphQL): raise exception when blob is missing Failures: 1) API::V2::GraphqlController when authenticated mutations dossierEnvoyerMessage upload error should fail Failure/Error: expect(gql_errors).to eq(nil) expected: nil got: [{:backtrace=>["/usr/local/bundle/ruby/2.7.0/gems/graphql-1.12.5/lib/graphql/backtrace/tracer.rb:64:i...] --- app/graphql/mutations/base_mutation.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb index aea9ca2a8..652046a06 100644 --- a/app/graphql/mutations/base_mutation.rb +++ b/app/graphql/mutations/base_mutation.rb @@ -5,6 +5,8 @@ module Mutations def validate_blob(blob_id) begin blob = ActiveStorage::Blob.find_signed(blob_id) + raise ActiveSupport::MessageVerifier::InvalidSignature if blob.nil? + # open downloads the file and checks its hash blob.open { |f| } true