mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Handle failed download when calculating image dominant color (#18342)
This can happen when the upload size exceeds the maximum upload size, or there is a network issue during download
This commit is contained in:
@@ -690,6 +690,15 @@ RSpec.describe Upload do
|
||||
expect(invalid_image.dominant_color).to eq(nil)
|
||||
end
|
||||
|
||||
it "correctly handles download failures" do
|
||||
white_image.stubs(:local?).returns(true)
|
||||
Discourse.store.stubs(:download).returns(nil)
|
||||
|
||||
expect(invalid_image.dominant_color).to eq(nil)
|
||||
expect(invalid_image.dominant_color(calculate_if_missing: true)).to eq("")
|
||||
expect(invalid_image.dominant_color).to eq("")
|
||||
end
|
||||
|
||||
it "is validated for length" do
|
||||
u = Fabricate(:upload)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user