Skip to content

Commit 619d1a6

Browse files
committed
comparing file paths on manifest files to dedupe
1 parent 6d4fc56 commit 619d1a6

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__author__ = 'socket.dev'
2-
__version__ = '1.0.38'
2+
__version__ = '1.0.39'

socketsecurity/core/__init__.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@ def create_full_scan(files: list, params: FullScanParams, workspace: str) -> Ful
475475
send_files = []
476476
create_full_start = time.time()
477477
log.debug("Creating new full scan")
478+
479+
# Track unique paths (case-insensitive) to avoid duplicates
480+
seen_paths = {}
481+
478482
for file in files:
479483
if platform.system() == "Windows":
480484
file = file.replace("\\", "/")
@@ -484,20 +488,27 @@ def create_full_scan(files: list, params: FullScanParams, workspace: str) -> Ful
484488
path = "."
485489
name = file
486490
full_path = f"{path}/{name}"
491+
487492
if full_path.startswith(workspace):
488493
key = full_path[len(workspace):]
489494
else:
490495
key = full_path
491496
key = key.lstrip("/")
492497
key = key.lstrip("./")
493-
payload = (
494-
key,
495-
(
496-
name,
497-
open(full_path, 'rb')
498+
499+
# Use lowercase version of key for deduplication
500+
lower_key = key.lower()
501+
if lower_key not in seen_paths:
502+
seen_paths[lower_key] = key
503+
payload = (
504+
key,
505+
(
506+
name,
507+
open(full_path, 'rb')
508+
)
498509
)
499-
)
500-
send_files.append(payload)
510+
send_files.append(payload)
511+
501512
query_params = urlencode(params.__dict__)
502513
full_uri = f"{full_scan_path}?{query_params}"
503514
response = do_request(full_uri, method="POST", files=send_files)

0 commit comments

Comments
 (0)