kopia lustrzana https://github.com/wagtail/wagtail
Prevent Draftail from crashing on links to missing pages
rodzic
6c7065ef99
commit
2f96465150
|
@ -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': [
|
||||
|
|
Ładowanie…
Reference in New Issue