diff --git a/app/logical/upload_service/preprocessor.rb b/app/logical/upload_service/preprocessor.rb index b1ebaab49..a42e5d0cf 100644 --- a/app/logical/upload_service/preprocessor.rb +++ b/app/logical/upload_service/preprocessor.rb @@ -104,7 +104,7 @@ class UploadService upload.status = "preprocessed" upload.save! rescue Exception => x - upload.update(status: "error: #{x.class} - #{x.message}", backtrace: x.backtrace.join("\n")) + upload.update(file_ext: nil, status: "error: #{x.class} - #{x.message}", backtrace: x.backtrace.join("\n")) end return upload diff --git a/test/models/upload_service_test.rb b/test/models/upload_service_test.rb index bcf05a509..395984d3a 100644 --- a/test/models/upload_service_test.rb +++ b/test/models/upload_service_test.rb @@ -489,6 +489,18 @@ class UploadServiceTest < ActiveSupport::TestCase end end + context "for an invalid content type" do + setup do + @source = "http://www.example.com" + @service = subject.new(source: @source) + end + + should "fail" do + upload = @service.start! + upload.reload + assert_match(/error:/, upload.status) + end + end end context "#finish!" do