Skip to content

MPCExplorer Harvester can crash on incomplete input #1356

@talister

Description

@talister

Describe the bug
Incomplete/invalid designations for the MPC Explorer search term can cause a crash with:

IndexError  at /catalogs/query
list index out of range
  
Request Method: POST
Request URL: http://127.0.0.1:8000/catalogs/query/
Django Version:  4.2.26
Exception type: IndexError
Exception value: list index out of range
Exception location: /home/tlister/venv/fomo_venv/lib/python3.12/site-packages/tom_catalogs/harvesters/mpc.py, line 133, in to_target
Raised during: tom_catalogs.views.CatalogQueryView

To Reproduce
Steps to reproduce the behavior:

  1. Go to Targets->Create Targets->Catalog search
  2. Select 'MPC Explorer'
  3. Enter 'C/202' in Term field
  4. See error

Expected behavior
Proper validation and rejection of bad value without crashing

Desktop:

  • OS: Windows 11
  • Browser: Firefox
  • Version: 2.27.1
  • Python Version: 3.12.3

Additional context
Will create a branch and fix in my fork my fork

Metadata

Metadata

Assignees

Labels

UserIssue Raised by a userbugSomething isn't working

Type

Projects

Status

Triage

Relationships

None yet

Development

No branches or pull requests

Issue actions