From 7aa10842863c8821768ac1d09172c94ffc484832 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Fri, 1 Nov 2024 13:08:01 -0400 Subject: [PATCH] oembed: add `__oembedError` to enable optional meta fallbacks --- lib/plugins/system/oembed/oembed.js | 9 +++++++-- .../domains/soundcloud.com/soundcloud-oembed-error.js | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/plugins/system/oembed/oembed.js b/lib/plugins/system/oembed/oembed.js index 94f1dcb36..0cae08424 100644 --- a/lib/plugins/system/oembed/oembed.js +++ b/lib/plugins/system/oembed/oembed.js @@ -129,14 +129,19 @@ export default { if (error && !oembed) { return cb('Oembed error "'+ oembedLinks[0].href + '": ' + error, { - oembedError: error + oembedError: error, + __oembedError: error // To enable fallbacks to optional meta }); } else if (error && oembed) { // via `options.parseErrorBody = true` return cb(null, { oembedError: { code: error, body: oembed - } + }, + __oembedError: { // To enable fallbacks to optional meta + code: error, + body: oembed + }, }); } diff --git a/plugins/domains/soundcloud.com/soundcloud-oembed-error.js b/plugins/domains/soundcloud.com/soundcloud-oembed-error.js index 1e9e94d62..6af3c7eff 100644 --- a/plugins/domains/soundcloud.com/soundcloud-oembed-error.js +++ b/plugins/domains/soundcloud.com/soundcloud-oembed-error.js @@ -2,7 +2,8 @@ export default { provides: ['__allow_soundcloud_meta', 'iframe'], - getData: function(oembedError, twitter, options, plugins, cb) { + getData: function(__oembedError, twitter, options, plugins, cb) { + var oembedError = __oembedError; var disable_private = options.getProviderOptions('soundcloud.disable_private', false) if (oembedError === 403 && !disable_private && twitter.player) { return cb(null, {