YouTube link cannot be pasted if user is not part of "Embedded media post allowed groups"

Priority/Severity: Medium (annoying but has workarounds)

Platform: Any

Description: When a user is not a part of the “Embedded media post allowed groups” setting, they cannot upload any media. That is to be expected.

However, if they try to post any YouTube URL (like https://www.youtube.com/watch?v=L3Dp4oGkn3k), this also breaks the Onebox preview functionality (maybe it’s trying to cook the preview image into a local copy; not sure?), resulting in the error message: “An error occurred: Sorry, you can’t embed media items in a post.” every time.

Reproducible steps:

  1. Create a new free trial account on hosted Discourse
  2. Remove all non-admin users from Embedded media post allowed groups
  3. Create a new user and authorize/approve them
  4. Log in as that user and try to paste a YouTube link
  5. You should see the error "An error occurred: Sorry, you can't embed media items in a post."

This seems to happen regardless of the “Download remote images to local” and other embed/upload-related settings.