Skip to content

Commit

Permalink
oembed: add __oembedError to enable optional meta fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
iparamonau committed Nov 1, 2024
1 parent f93d596 commit 7aa1084
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/plugins/system/oembed/oembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
});
}

Expand Down
3 changes: 2 additions & 1 deletion plugins/domains/soundcloud.com/soundcloud-oembed-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 7aa1084

Please sign in to comment.