Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6d4fc56

Browse files
manifest file search now case-insensitive (#35)
1 parent f874edb commit 6d4fc56

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
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.37'
2+
__version__ = '1.0.38'

‎socketsecurity/core/__init__.py‎

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,15 @@ def match_supported_files(files: list) -> bool:
410410
patterns = socket_globs[ecosystem]
411411
for file_name in patterns:
412412
pattern = patterns[file_name]["pattern"]
413-
# path_pattern = f"**/{pattern}"
414413
for file in files:
415414
if "\\" in file:
416415
file = file.replace("\\", "/")
417-
if PurePath(file).match(pattern):
418-
matched_files.append(file)
416+
# Split path and filename
417+
path_parts = PurePath(file).parts
418+
if path_parts:
419+
# Compare only the filename portion case-insensitively
420+
if PurePath(path_parts[-1].lower()).match(pattern.lower()):
421+
matched_files.append(file)
419422
if len(matched_files) == 0:
420423
not_matched = True
421424
return not_matched
@@ -435,17 +438,24 @@ def find_files(path: str) -> list:
435438
patterns = socket_globs[ecosystem]
436439
for file_name in patterns:
437440
pattern = patterns[file_name]["pattern"]
438-
file_path = f"{path}/**/{pattern}"
439-
440-
log.debug(f"Globbing {file_path}")
441-
glob_start = time.time()
442-
glob_files = glob(file_path, recursive=True)
443-
for glob_file in glob_files:
444-
if glob_file not in files:
445-
files.add(glob_file)
446-
glob_end = time.time()
447-
glob_total_time = glob_end - glob_start
448-
log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
441+
# Keep path as-is but try filename variations
442+
file_paths = [
443+
f"{path}/**/{pattern}",
444+
f"{path}/**/{pattern.lower()}",
445+
f"{path}/**/{pattern.upper()}",
446+
f"{path}/**/{pattern.capitalize()}"
447+
]
448+
449+
for file_path in file_paths:
450+
log.debug(f"Globbing {file_path}")
451+
glob_start = time.time()
452+
glob_files = glob(file_path, recursive=True)
453+
for glob_file in glob_files:
454+
if glob_file not in files:
455+
files.add(glob_file)
456+
glob_end = time.time()
457+
glob_total_time = glob_end - glob_start
458+
log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
449459

450460
log.debug("Finished Find Files")
451461
end_time = time.time()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /