mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Make sure max_oneboxes_per_post is enforced (#16215)
PostAnalyzer and CookedPostProcessor both replace URLs with oneboxes. PostAnalyzer did not use the max_oneboxes_per_post site and setting and CookedPostProcessor replaced at most max_oneboxes_per_post URLs ignoring the oneboxes that were replaced already by PostAnalyzer.
This commit is contained in:
@@ -31,7 +31,11 @@ class PostAnalyzer
|
||||
cooked = PrettyText.cook(raw, opts)
|
||||
end
|
||||
|
||||
limit = SiteSetting.max_oneboxes_per_post
|
||||
result = Oneboxer.apply(cooked) do |url|
|
||||
next if limit <= 0
|
||||
limit -= 1
|
||||
|
||||
@onebox_urls << url
|
||||
if opts[:invalidate_oneboxes]
|
||||
Oneboxer.invalidate(url)
|
||||
|
||||
Reference in New Issue
Block a user