Skip to content

Commit

Permalink
fix: search.py after PR frappe#17828 (frappe#18719) (frappe#18721)
Browse files Browse the repository at this point in the history
* fix search.py

After the PR frappe#17828 in some cases an "IndexError: list assignment index out of range" error is thrown. This should fix it.

* Update search.py

Yes, that should be even better

* style: formatting

[skip ci]

(cherry picked from commit 58cef60)

Co-authored-by: DrZoidberg09 <96449693+DrZoidberg09@users.noreply.github.com>
  • Loading branch information
mergify[bot] and DrZoidberg09 authored Nov 2, 2022
1 parent bcee688 commit d5f39ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frappe/desk/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ def to_string(parts):
item = list(item)
label = item[1] # use title as label
item[1] = item[0] # show name in description instead of title
del item[2] # remove redundant title ("label") value
if len(item) >= 3:
del item[2] # remove redundant title ("label") value
results.append({"value": item[0], "label": label, "description": to_string(item[1:])})
else:
results.extend({"value": item[0], "description": to_string(item[1:])} for item in res)
Expand Down

0 comments on commit d5f39ea

Please sign in to comment.