Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback IndexError: list index out of range when trying to destroy a deleted item #1720

Closed
UlrichB22 opened this issue Aug 4, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@UlrichB22
Copy link
Collaborator

To reproduce this issue:

  • Create a new item TrashTest
  • Delete the item
  • Select the item from history using the itemid
  • Destroy the item

The resulting traceback is:

Traceback (most recent call last):
  File "/my-moin-path/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my-moin-path/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my-moin-path/moin-venv-python3/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/my-moin-path/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 "/my-moin-path/moin/src/moin/apps/frontend/views.py", line 1257, in destroy_item
    item.destroy(comment=comment, destroy_item=destroy_item, subitem_names=subitem_names)
  File "/my-moin-path/moin/src/moin/items/__init__.py", line 919, in destroy
    old_name = self.names if len(self.names) > 1 else self.names[0]
                                                      ~~~~~~~~~~^^^
IndexError: list index out of range
2024-08-04 18:14:09,865 INFO werkzeug:97 127.0.0.1 "POST /+destroy/@itemid/6409c3cc45b948878e6c49f90b600d97 HTTP/1.1" 500 -

When deleting an item the name in metadata is set to None after moving it to "old name".

@UlrichB22 UlrichB22 added the bug Something isn't working label Aug 4, 2024
@RogerHaase RogerHaase self-assigned this Oct 7, 2024
UlrichB22 added a commit that referenced this issue Oct 7, 2024
eliminate traceback when destroying a deleted item; fixes #1720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants