moinwiki/moin

Traceback IndexError: list index out of range - when trying to delete an item from namespace using +index view

Closed this issue · 0 comments

To reproduce you can run the built-in server:

  • create new item users/testdelete
  • open users/index (+index/users)
  • check users/testdelete
  • click on Delete
  • click on Submit
2024-09-17 22:40:39,294 ERROR moin:838 Exception on /+ajaxdelete/users [POST]
Traceback (most recent call last):
  File "/mypath/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/apps/frontend/views.py", line 1043, in ajaxdelete
    return ajaxdestroy(item_name, req="delete")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/apps/frontend/views.py", line 1086, in ajaxdestroy
    messages, subitem_names = item.delete(comment, do_subitems=do_subitems, ajax=True)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/items/__init__.py", line 895, in delete
    ret = self._rename(self.names, comment, action=ACTION_TRASH, delete=True, do_subitems=do_subitems, ajax=ajax)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/items/__init__.py", line 802, in _rename
    self._save(self.meta, self.content.data, names=names, action=action, comment=comment, delete=delete)
  File "/mypath/moin/src/moin/items/__init__.py", line 1149, in _save
    fqname, new_meta = storage_item.store_revision(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/storage/middleware/protecting.py", line 419, in store_revision
    rev = self.item.store_revision(meta, data, overwrite=overwrite, return_rev=return_rev, fqname=fqname, **kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/storage/middleware/indexing.py", line 1286, in store_revision
    meta, data, content = self.preprocess(meta, data)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/storage/middleware/indexing.py", line 1173, in preprocess
    content = convert_to_indexable(meta, data, self.name, is_new=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/moin/src/moin/storage/middleware/indexing.py", line 241, in convert_to_indexable
    item_name = meta[NAMESPACE] + "/" + meta[NAME][0]
                                        ~~~~~~~~~~^^^
IndexError: list index out of range