DEV: Update call sites using BaseStore#download but expecting exceptions (#21551)

In #21498, we split `BaseStore#download` into a "safe" version which returns nil on errors, and an "unsafe" version which raises an exception, which was the old behaviour of `#download`.

This change updates call sites that used the old `#download`, which raised exceptions, to use the new `#download!` to preserve behaviour (and silence deprecation warnings.)

It also silences the deprecation warning in tests.
This commit is contained in:
Ted Johansson
2023-05-17 16:03:33 +08:00
committed by GitHub
parent 8d58b1c6b8
commit a2bc24456f
4 changed files with 11 additions and 11 deletions

View File

@ -144,7 +144,7 @@ class Upload < ActiveRecord::Base
external_copy = nil
if original_path.blank?
external_copy = Discourse.store.download(self)
external_copy = Discourse.store.download!(self)
original_path = external_copy.path
end
@ -268,14 +268,14 @@ class Upload < ActiveRecord::Base
def fix_dimensions!
return if !FileHelper.is_supported_image?("image.#{extension}")
path =
if local?
Discourse.store.path_for(self)
else
Discourse.store.download(self).path
end
begin
path =
if local?
Discourse.store.path_for(self)
else
Discourse.store.download!(self).path
end
if extension == "svg"
w, h =
begin