project Utilities / File Location Listing avatar

utilities/file_location_listing#32: Searching with matchtype triggers exception

Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.2.1
Created: 01-Jan-24 15:02


Picked up during testing.

Adding a matchtype operator to a search triggered an exception

  File "/usr/lib/python3.10/concurrent/futures/", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ben/Documents/src.old/file_location_listing/./server/../lib/", line 101, in searchIndexChunk
    url = e[m[0]].lower()

Toggle State Changes


assigned to @btasker

This happens because conditionals have been combined when testing keywords a little further up that function:

if m[0] == "k" and filters['fu']['matchtype'] in ['ANY', 'tag'] : 

url = e[m[0]].lower()

So, if m[0] == "k" but matchtype has been set to title or url we won't enter that conditional block.

But e['k'] is a list, so we obviously can't call lower() on it.

That earlier conditional needs breaking into two, with a continue occurring regardless of whether the second conditional matches or not.


mentioned in commit 7dcbecb83eff4fe5db022391a1106fa5d8bd1cd3

Commit: 7dcbecb83eff4fe5db022391a1106fa5d8bd1cd3 
Author: B Tasker                            
Date: 2024-01-01T15:08:19.000+00:00 


fix: don't attempt to cast tags dict to lowercase (utilities/file_location_listing#32)

+31 -30 (61 lines changed)