mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
Fixed error when saving unknown url in bookmark card (#11210)
no issue - `payload.metadata` may not exist in a bookmark card because it's possible to save a mobiledoc document when the card is in it's "unable to parse url" state in the editor - check for `payload.metadata` object before performing any url transformations to avoid invalid property access
This commit is contained in:
parent
f1ef801b78
commit
d9a0c8732c
@ -93,13 +93,17 @@ module.exports = createCard({
|
||||
},
|
||||
|
||||
absoluteToRelative(urlUtils, payload, options) {
|
||||
payload.metadata.url = payload.metadata.url && urlUtils.absoluteToRelative(payload.metadata.url, options);
|
||||
if (payload.metadata) {
|
||||
payload.metadata.url = payload.metadata.url && urlUtils.absoluteToRelative(payload.metadata.url, options);
|
||||
}
|
||||
payload.caption = payload.caption && urlUtils.htmlAbsoluteToRelative(payload.caption, options);
|
||||
return payload;
|
||||
},
|
||||
|
||||
relativeToAbsolute(urlUtils, payload, options) {
|
||||
payload.metadata.url = payload.metadata.url && urlUtils.relativeToAbsolute(payload.metadata.url, options);
|
||||
if (payload.metadata) {
|
||||
payload.metadata.url = payload.metadata.url && urlUtils.relativeToAbsolute(payload.metadata.url, options);
|
||||
}
|
||||
payload.caption = payload.caption && urlUtils.htmlRelativeToAbsolute(payload.caption, options);
|
||||
return payload;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user