mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +08:00
FIX: Copying image markdown for secure media loading full image (#9488)
* When copying the markdown for an image between posts, we were not adding the srcset and data-small-image attributes which are done by calling optimize_image! in cooked post processor * Refactored the code which was confusing in its current state (the consider_for_reuse method was super confusing) and fixed the issue
This commit is contained in:
@ -339,12 +339,7 @@ class CookedPostProcessor
|
||||
width, height = ImageSizer.resize(width, height)
|
||||
end
|
||||
|
||||
# if the upload already exists and is attached to a different post,
|
||||
# or the original_sha1 is missing meaning it was created before secure
|
||||
# media was enabled. we want to re-thumbnail and re-optimize in this case
|
||||
# to avoid using uploads linked to many other posts
|
||||
upload = Upload.consider_for_reuse(Upload.get_from_url(src), @post)
|
||||
|
||||
upload = Upload.get_from_url(src)
|
||||
if upload.present?
|
||||
upload.create_thumbnail!(width, height, crop: crop)
|
||||
|
||||
|
Reference in New Issue
Block a user