Fix crash when invalid note link

Fixes #012854
This commit is contained in:
SNoiraud 2023-03-18 11:42:51 +01:00 committed by Nick Hall
parent e535fcefa5
commit 4ebba02b6b
3 changed files with 4 additions and 4 deletions

View File

@ -346,7 +346,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase):
for tag in note.text.get_tags():
if tag.name == 'Link':
if tag.value.startswith("gramps://"):
obj_class, prop, value = tag.value[9:].split("/")
obj_class, prop, value = tag.value[9:].split("/", 2)
if obj_class == "Media": # bug6493
obj_class = "Media"
if prop == "handle":

View File

@ -396,7 +396,7 @@ class StyledTextEditor(Gtk.TextView):
simple_access = SimpleAccess(win_obj.dbstate.db)
url = link_tag.data
if url.startswith("gramps://"):
obj_class, prop, value = url[9:].split("/")
obj_class, prop, value = url[9:].split("/", 2)
display = simple_access.display(obj_class, prop, value) or url
return display + ((_("\nCommand-Click to follow link") if mac() else
_("\nCtrl-Click to follow link"))
@ -809,7 +809,7 @@ class StyledTextEditor(Gtk.TextView):
win_obj = find_parent_with_attr(self, attr="dbstate")
if win_obj:
# Edit the object:
obj_class, prop, value = url[9:].split("/")
obj_class, prop, value = url[9:].split("/", 2)
from ..editors import EditObject
EditObject(win_obj.dbstate,
win_obj.uistate,

View File

@ -300,7 +300,7 @@ class HtmlBackend(DocBackend):
"""
if value.startswith("gramps://"):
if self.build_link:
obj_class, prop, handle = value[9:].split("/", 3)
obj_class, prop, handle = value[9:].split("/", 2)
if prop in ["handle", "gramps_id"]:
value = self.build_link(prop, handle, obj_class)
if not value: