Skip to content

Fix Windows Path Normalization #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"

[project]
name = "socketsecurity"
version = "2.0.43"
version = "2.0.48"
requires-python = ">= 3.10"
license = {"file" = "LICENSE"}
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion socketsecurity/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__author__ = 'socket.dev'
__version__ = '2.0.43'
__version__ = '2.0.48'
12 changes: 5 additions & 7 deletions socketsecurity/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def find_files(self, path: str) -> List[str]:

for glob_file in glob_files:
if os.path.isfile(glob_file) and not Core.is_excluded(glob_file, self.config.excluded_dirs):
files.add(glob_file)
files.add(glob_file.replace("\\", "/"))

glob_end = time.time()
log.debug(f"Globbing took {glob_end - glob_start:.4f} seconds")
Expand Down Expand Up @@ -290,12 +290,10 @@ def load_files_for_sending(files: List[str], workspace: str) -> List[Tuple[str,
[(field_name, (filename, file_object)), ...]
"""
send_files = []

if "\\" in workspace:
workspace = workspace.replace("\\", "/")
for file_path in files:
if "/" in file_path:
_, name = file_path.rsplit("/", 1)
else:
name = file_path
_, name = file_path.rsplit("/", 1)

if file_path.startswith(workspace):
key = file_path[len(workspace):]
Expand All @@ -306,7 +304,7 @@ def load_files_for_sending(files: List[str], workspace: str) -> List[Tuple[str,
key = key.lstrip("./")

f = open(file_path, 'rb')
payload = (key, (name, f))
payload = (key, (name.lstrip(workspace), f))
send_files.append(payload)

return send_files
Expand Down
Loading