fix invalid content type leaving upload stuck in preprocessing status (#3896)
This commit is contained in:
@@ -104,7 +104,7 @@ class UploadService
|
|||||||
upload.status = "preprocessed"
|
upload.status = "preprocessed"
|
||||||
upload.save!
|
upload.save!
|
||||||
rescue Exception => x
|
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
|
end
|
||||||
|
|
||||||
return upload
|
return upload
|
||||||
|
|||||||
@@ -489,6 +489,18 @@ class UploadServiceTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
context "#finish!" do
|
context "#finish!" do
|
||||||
|
|||||||
Reference in New Issue
Block a user