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...]
This commit is contained in:
François Vantomme 2021-04-14 21:56:36 +02:00 committed by Pierre de La Morinerie
parent 691262340d
commit cb717aede2

View file

@ -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