Skip to content

Commit

Permalink
Filter using extension field rather than path #238
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Jul 26, 2021
1 parent 7fb0eb6 commit c98bba1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scanpipe/pipes/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def tag_uninteresting_windows_codebase_resources(project):
for file_name in uninteresting_files:
lookups |= Q(path__iendswith=file_name)
for file_extension in uninteresting_file_extensions:
lookups |= Q(path__icontains=file_extension)
lookups |= Q(extension__icontains=file_extension)

qs = project.codebaseresources.no_status()
qs.filter(lookups).update(status="ignored-not-interesting")
Expand Down
9 changes: 6 additions & 3 deletions scanpipe/tests/test_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,8 @@ def test_scanpipe_pipes_windows_tag_uninteresting_windows_codebase_resources(sel
resource1 = CodebaseResource.objects.create(
project=p1,
path="root/Files/example.lnk",
rootfs_path="/Files/example.lnk"
rootfs_path="/Files/example.lnk",
extension=".lnk"
)
resource2 = CodebaseResource.objects.create(
project=p1,
Expand All @@ -772,12 +773,14 @@ def test_scanpipe_pipes_windows_tag_uninteresting_windows_codebase_resources(sel
resource3 = CodebaseResource.objects.create(
project=p1,
path="root/Files/example.dat",
rootfs_path="/Files/example.dat"
rootfs_path="/Files/example.dat",
extension=".dat"
)
resource4 = CodebaseResource.objects.create(
project=p1,
path="root/Files/User/Test/foo.dat",
rootfs_path="/Files/User/Test/foo.dat"
rootfs_path="/Files/User/Test/foo.dat",
extension=".dat"
)

windows.tag_uninteresting_windows_codebase_resources(p1)
Expand Down

0 comments on commit c98bba1

Please sign in to comment.