misc: accept link cells with just an anchor as valid (#40644)

This commit is contained in:
Frédéric Péters 2020-03-11 11:29:19 +01:00
parent 75957c0d23
commit ebcfd93e79
2 changed files with 9 additions and 0 deletions

View File

@ -1104,6 +1104,10 @@ class LinkCell(CellBase):
self.mark_as_valid()
return
if not self.url:
if self.anchor:
# link to anchor on same page, ok.
self.mark_as_valid()
return
self.mark_as_invalid('data_url_not_defined')
return

View File

@ -159,6 +159,11 @@ def test_link_cell_validity():
assert validity_info.invalid_reason_code == 'data_url_not_defined'
assert validity_info.invalid_since is not None
# no link defined but anchor set
cell.anchor = 'plop'
cell.save()
assert ValidityInfo.objects.exists() is False
# internal link - no check
cell.link_page = page
with mock.patch('combo.data.models.requests.get') as requests_get: