mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
FIX: Do not use SVGs for twitter:image metadata (#16973)
Twitter does not allow SVGs to be used for twitter:image metadata (see https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup) so we should fall back to the site logo if the image option provided to `crawlable_meta_data` or SiteSetting.site_twitter_summary_large_image_url is an SVG, and do not add the meta tag for twitter:image at all if the site logo is an SVG.
This commit is contained in:
@ -245,6 +245,12 @@ module SiteSettings::Validations
|
||||
validate_error :strip_image_metadata_cannot_be_disabled_if_composer_media_optimization_image_enabled
|
||||
end
|
||||
|
||||
def validate_twitter_summary_large_image(new_val)
|
||||
return if new_val.blank?
|
||||
return if !Upload.exists?(id: new_val, extension: "svg")
|
||||
validate_error :twitter_summary_large_image_no_svg
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_bucket_setting(setting_name, upload_bucket, backup_bucket)
|
||||
|
Reference in New Issue
Block a user