]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: only filter by string or number properties for filter pipe (#7699)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sat, 14 Sep 2024 03:41:31 +0000 (20:41 -0700)
committerGitHub <noreply@github.com>
Sat, 14 Sep 2024 03:41:31 +0000 (20:41 -0700)
src-ui/src/app/pipes/filter.pipe.ts

index d48c2ad5d29ab70126dd89281a765f315b0fb42e..64765bd6a8095fd7da8f210b20fabf230126c1ec 100644 (file)
@@ -10,11 +10,16 @@ export class FilterPipe implements PipeTransform {
     if (!searchText) return items
 
     return items.filter((item) => {
-      return Object.keys(item).some((key) => {
-        return String(item[key])
-          .toLowerCase()
-          .includes(searchText.toLowerCase())
-      })
+      return Object.keys(item)
+        .filter(
+          (key) =>
+            typeof item[key] === 'string' || typeof item[key] === 'number'
+        )
+        .some((key) => {
+          return String(item[key])
+            .toLowerCase()
+            .includes(searchText.toLowerCase())
+        })
     })
   }
 }