mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-26 09:34:50 +00:00
Prevent Draftail from crashing on links to missing pages
This commit is contained in:
parent
6c7065ef99
commit
2f96465150
2 changed files with 9 additions and 2 deletions
|
|
@ -206,7 +206,12 @@ class PageLinkElementHandler(LinkElementHandler):
|
|||
try:
|
||||
page = Page.objects.get(id=attrs['id']).specific
|
||||
except Page.DoesNotExist:
|
||||
return {}
|
||||
# retain ID so that it's still identified as a page link (albeit a broken one)
|
||||
return {
|
||||
'id': int(attrs['id']),
|
||||
'url': None,
|
||||
'parentId': None
|
||||
}
|
||||
|
||||
parent_page = page.get_parent()
|
||||
|
||||
|
|
|
|||
|
|
@ -326,7 +326,9 @@ class TestHtmlToContentState(TestCase):
|
|||
'entityMap': {
|
||||
'0': {
|
||||
'mutability': 'MUTABLE', 'type': 'LINK',
|
||||
'data': {}
|
||||
'data': {
|
||||
'id': 9999, 'url': None, 'parentId': None,
|
||||
}
|
||||
}
|
||||
},
|
||||
'blocks': [
|
||||
|
|
|
|||
Loading…
Reference in a new issue