mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:52:43 +08:00

This issue was found via Discobot. In part of the tutorial for Discobot, it asks for a URL on one line so it can demonstrate how oneboxes work. The way it does this when the user replies is to cook the post raw and check if there is a cached onebox for the URL in the post. However, if you reply really fast to Discobot with the URL without waiting for the onebox to appear in the composer preview, it's not cached by the time we do this check in the Discobot code. This commit fixes the issue by following a more simplified approach, where we check for the existence of one of the following links from the onebox instructions: ``` https://en.wikipedia.org/wiki/Inherently_funny_word https://en.wikipedia.org/wiki/Death_by_coconut https://en.wikipedia.org/wiki/Calculator_spelling ``` This will fall down if someone customizes the onebox step text, or if the user uses a different link instead, but we are willing to accept that risk at this time to simplify things.