Zim

Misformatted link [[||]] corrupts pages

Bug #1199820 reported by K. Bauer
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zim
Fix Released
High
Unassigned

Bug Description

How to reproduce:

    Type [[||]] or [[Hello||World]] into a ZIM page.
    Preferably one you don't mind deleting.

A sequence [[||]] causes a ZIM page to raise an exception whenever it is opened. Once a file contains this corrupt markup, the exception will be raised whenever I try to access the corresponding page. Only editing the wiki source can rescue a page.

The same applies to any other link containing two || in source.

If the link target or text contain single | pipe | characters, it will only confuse ZIM causing the part before the first pipe to be taken as the target, the second as the text and the third or later ignored for good meassure.

The problem seems to be that a sequence [[Text1||Text2]] is interpreted as a link with target Text1 but empty visual representation.

For me this problem occurred when experimenting with my makeshift table plugin, but similiar sequences may occur when naivly pasting text into ZIM.

The traceback information:

This is zim 0.60
Python version is sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0)
Gtk version is (2, 24, 10)
Pygtk version is (2, 24, 0)
Platform is nt
Zim revision is:
  branch: pyzim-trunk
  revision: 672 <email address hidden>
  date: 2013-04-30 19:27:20 +0200

======= Traceback =======
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 4659, in set_page
    self.set_parsetree(tree, bool(template))
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 4750, in set_parsetree
    buffer.set_parsetree(tree)
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 605, in set_parsetree
    self.insert_parsetree_at_cursor(tree)
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 672, in insert_parsetree_at_cursor
    self._insert_element_children(root, raw=raw)
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 745, in _insert_element_children
    self._insert_element_children(element, list_level=list_level, raw=raw) # recurs
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 786, in _insert_element_children
    self.insert_link_at_cursor(element.text, **element.attrib)
  File "E:\devel\python\zim-0.60\zim\gui\pageview.py", line 846, in insert_link_at_cursor
    self.insert_at_cursor(text)
TypeError: GtkTextBuffer.insert_at_cursor() argument 1 must be string or read-only buffer, not None

Changed in zim:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fix committed in rev709 of branch pyzim-refactor

Changed in zim:
status: Confirmed → Fix Committed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fixed in release 0.61

Changed in zim:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.