ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
4.82k stars 1.19k forks source link

Filter for Tag produces wrong result when more than 9 tags have been created #3960

Closed Simpler1 closed 1 month ago

Simpler1 commented 1 month ago

Describe Your Environment

Describe the bug A filter for "Tag contains" actually does a sql query using "Tag.Id" LIKE '%2%' which results in all tags that have that number in their Id. In this example, entries containing the tag with an Id of 2 is the desired result, but all tags with Ids of 2, 12, 20, 21, etc are returned.

Here's the line of code that is using the Id instead of the Name: https://github.com/ZoneMinder/zoneminder/blob/d51fb62e266fd0f934a40cfc1dade1fc58bb6bd6/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm#L168

To Reproduce Steps to reproduce the behavior:

  1. Make sure you have more than 10 tags
  2. Check the Ids of your tags
  3. Create a filter for one of your tags with an Id of a single digit
  4. The results will include all events with tags that have Ids that contain the digit of the Id of the tag that you searched for

Expected behavior Only events containing the searched tag should be returned.