Edgewall Software

Opened 7 years ago

Last modified 7 years ago

#12748 closed defect

ERROR: Macro Image(,) failed: IndexError: pop from empty list — at Initial Version

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone: 1.2.1
Component: wiki system Version:
Severity: normal Keywords: imagemacro
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

2017-03-26 19:02:18,394 Trac[formatter] ERROR: Macro Image(,) failed:
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 793, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 362, in process
    text = self.processor(text)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 349, in _macro_processor
    text)
  File "build/bdist.linux-x86_64/egg/trac/wiki/macros.py", line 539, in expand_macro
    filespec = args.pop(0)
IndexError: pop from empty list

Proposed fix:

  • trac/wiki/macros.py

    diff --git a/trac/wiki/macros.py b/trac/wiki/macros.py
    index ff502b567..71ec10467 100644
    a b class ImageMacro(WikiMacroBase):  
    538538    _quoted_re = re.compile("(?:[\"'])(.*)(?:[\"'])$")
    539539
    540540    def expand_macro(self, formatter, name, content):
     541        args = None
    541542        if content:
    542543            content = stripws(content)
    543         if not content:
     544            # parse arguments
     545            # we expect the 1st argument to be a filename (filespec)
     546            args = [stripws(arg) for arg
     547                                 in self._split_args_re.split(content)[1::2]]
     548        if not args:
    544549            return ''
    545         # parse arguments
    546         # we expect the 1st argument to be a filename (filespec)
    547         args = [stripws(arg) for arg
    548                              in self._split_args_re.split(content)[1::2]]
    549550        # strip unicode white-spaces and ZWSPs are copied from attachments
    550551        # section (#10668)
    551552        filespec = args.pop(0)

Change History (0)

Note: See TracTickets for help on using tickets.