Skip to content

Commit 96e6920

Browse files
authored
Fix Windows Path Normalization (#75)
* Update version for deploy * Version updated * Stripping path from file name as well * Fixing workspace name * Removed redundant strip
1 parent daa7f85 commit 96e6920

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.0.43"
9+
version = "2.0.48"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

Diff for: socketsecurity/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.0.43'
2+
__version__ = '2.0.48'

Diff for: socketsecurity/core/__init__.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def find_files(self, path: str) -> List[str]:
201201

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

206206
glob_end = time.time()
207207
log.debug(f"Globbing took {glob_end - glob_start:.4f} seconds")
@@ -290,12 +290,10 @@ def load_files_for_sending(files: List[str], workspace: str) -> List[Tuple[str,
290290
[(field_name, (filename, file_object)), ...]
291291
"""
292292
send_files = []
293-
293+
if "\\" in workspace:
294+
workspace = workspace.replace("\\", "/")
294295
for file_path in files:
295-
if "/" in file_path:
296-
_, name = file_path.rsplit("/", 1)
297-
else:
298-
name = file_path
296+
_, name = file_path.rsplit("/", 1)
299297

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

308306
f = open(file_path, 'rb')
309-
payload = (key, (name, f))
307+
payload = (key, (name.lstrip(workspace), f))
310308
send_files.append(payload)
311309

312310
return send_files

0 commit comments

Comments
 (0)