socketdev 3.0.13__py3-none-any.whl → 3.0.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- socketdev/utils/__init__.py +63 -49
- socketdev/version.py +1 -1
- {socketdev-3.0.13.dist-info → socketdev-3.0.14.dist-info}/METADATA +1 -1
- {socketdev-3.0.13.dist-info → socketdev-3.0.14.dist-info}/RECORD +6 -6
- {socketdev-3.0.13.dist-info → socketdev-3.0.14.dist-info}/WHEEL +0 -0
- {socketdev-3.0.13.dist-info → socketdev-3.0.14.dist-info}/licenses/LICENSE +0 -0
socketdev/utils/__init__.py
CHANGED
|
@@ -269,63 +269,77 @@ class Utils:
|
|
|
269
269
|
if "\\" in file_path:
|
|
270
270
|
file_path = file_path.replace("\\", "/")
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
for file_path in files:
|
|
273
|
+
# Normalize file path
|
|
274
|
+
if "\\" in file_path:
|
|
275
|
+
file_path = file_path.replace("\\", "/")
|
|
273
276
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
277
|
+
# Skip directories
|
|
278
|
+
if os.path.isdir(file_path):
|
|
279
|
+
continue
|
|
280
|
+
|
|
281
|
+
# Handle file path splitting safely
|
|
282
|
+
if "/" in file_path:
|
|
283
|
+
_, name = file_path.rsplit("/", 1)
|
|
284
|
+
else:
|
|
285
|
+
name = file_path
|
|
286
|
+
|
|
287
|
+
# Calculate the key name for the form data
|
|
288
|
+
key = file_path
|
|
289
|
+
path_stripped = False
|
|
290
|
+
|
|
291
|
+
# If base_paths is provided, try to strip one of the paths from the file path
|
|
292
|
+
if base_paths:
|
|
293
|
+
for bp in base_paths:
|
|
294
|
+
normalized_base_path = bp.rstrip("/") + "/" if not bp.endswith("/") else bp
|
|
295
|
+
if key.startswith(normalized_base_path):
|
|
296
|
+
key = key[len(normalized_base_path):]
|
|
297
|
+
path_stripped = True
|
|
298
|
+
break
|
|
299
|
+
elif key.startswith(bp.rstrip("/")):
|
|
300
|
+
stripped_base = bp.rstrip("/")
|
|
301
|
+
if key.startswith(stripped_base + "/") or key == stripped_base:
|
|
302
|
+
key = key[len(stripped_base):]
|
|
303
|
+
key = key.lstrip("/")
|
|
304
|
+
path_stripped = True
|
|
305
|
+
break
|
|
306
|
+
elif base_path:
|
|
307
|
+
normalized_base_path = base_path.rstrip("/") + "/" if not base_path.endswith("/") else base_path
|
|
283
308
|
if key.startswith(normalized_base_path):
|
|
284
309
|
key = key[len(normalized_base_path):]
|
|
285
310
|
path_stripped = True
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
# Handle case where base_path matches exactly without trailing slash
|
|
289
|
-
stripped_base = bp.rstrip("/")
|
|
311
|
+
elif key.startswith(base_path.rstrip("/")):
|
|
312
|
+
stripped_base = base_path.rstrip("/")
|
|
290
313
|
if key.startswith(stripped_base + "/") or key == stripped_base:
|
|
291
314
|
key = key[len(stripped_base):]
|
|
292
315
|
key = key.lstrip("/")
|
|
293
316
|
path_stripped = True
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
key = key[len(normalized_base_path):]
|
|
317
|
+
|
|
318
|
+
# If workspace is provided and no base paths matched, fall back to workspace logic
|
|
319
|
+
if not path_stripped and workspace and file_path.startswith(workspace):
|
|
320
|
+
key = file_path[len(workspace):]
|
|
321
|
+
# Remove all leading slashes (for absolute paths)
|
|
322
|
+
while key.startswith("/"):
|
|
323
|
+
key = key[1:]
|
|
302
324
|
path_stripped = True
|
|
303
|
-
elif key.startswith(base_path.rstrip("/")):
|
|
304
|
-
# Handle case where base_path matches exactly without trailing slash
|
|
305
|
-
stripped_base = base_path.rstrip("/")
|
|
306
|
-
if key.startswith(stripped_base + "/") or key == stripped_base:
|
|
307
|
-
key = key[len(stripped_base):]
|
|
308
|
-
key = key.lstrip("/")
|
|
309
|
-
path_stripped = True
|
|
310
|
-
|
|
311
|
-
# If workspace is provided and no base paths matched, fall back to workspace logic
|
|
312
|
-
if not path_stripped and workspace and file_path.startswith(workspace):
|
|
313
|
-
key = file_path[len(workspace):]
|
|
314
|
-
key = key.lstrip("/")
|
|
315
|
-
key = key.lstrip("./")
|
|
316
|
-
path_stripped = True
|
|
317
|
-
|
|
318
|
-
# If no path stripping occurred, clean up the key
|
|
319
|
-
if not path_stripped:
|
|
320
|
-
# No base_path, base_paths, or workspace stripping occurred, clean up leading parts
|
|
321
|
-
key = key.lstrip("/")
|
|
322
|
-
key = key.lstrip("./")
|
|
323
325
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
# Clean up relative path prefixes, but preserve filename dots
|
|
327
|
+
while key.startswith("./"):
|
|
328
|
+
key = key[2:]
|
|
329
|
+
while key.startswith("../"):
|
|
330
|
+
key = key[3:]
|
|
331
|
+
# Remove any remaining leading slashes (for absolute paths)
|
|
332
|
+
while key.startswith("/"):
|
|
333
|
+
key = key[1:]
|
|
334
|
+
|
|
335
|
+
# Remove Windows drive letter if present (C:/...)
|
|
336
|
+
if len(key) > 2 and key[1] == ':' and (key[2] == '/' or key[2] == '\\'):
|
|
337
|
+
key = key[2:]
|
|
338
|
+
while key.startswith("/"):
|
|
339
|
+
key = key[1:]
|
|
329
340
|
|
|
330
|
-
|
|
331
|
-
|
|
341
|
+
# Create lazy file loader instead of opening file immediately
|
|
342
|
+
lazy_file = LazyFileLoader(file_path, key)
|
|
343
|
+
payload = (key, (key, lazy_file))
|
|
344
|
+
send_files.append(payload)
|
|
345
|
+
return send_files
|
socketdev/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "3.0.
|
|
1
|
+
__version__ = "3.0.14"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
socketdev/__init__.py,sha256=oWS-XPjIu0o75jcHLJyhiR47u-uPLZ7BM4nhpdyxZvw,2888
|
|
2
2
|
socketdev/exceptions.py,sha256=SNU1EgswGwnxI_Zmm325ruP6CFg5C4MsS1qxXWwBJqs,1120
|
|
3
3
|
socketdev/log.py,sha256=AgEcsPN3y9U-fze8pTFvLigVvNob2vmNC-TkOOQkkeQ,90
|
|
4
|
-
socketdev/version.py,sha256=
|
|
4
|
+
socketdev/version.py,sha256=58nfUJ61Il-p2ZdVf2gSLjPEImF5AgR3gUR-VmZM5VA,23
|
|
5
5
|
socketdev/alerttypes/__init__.py,sha256=W-m2D9VxbepSAUELJPmWmX40zksGZbQcSzwQ1kjlB1k,1169
|
|
6
6
|
socketdev/analytics/__init__.py,sha256=kQGeO67TraqvfmYjfpYCvcNRtxW2a6x5EefEl6Jnca8,2223
|
|
7
7
|
socketdev/apitokens/__init__.py,sha256=Z6W9Jkh4gdDeJBivfcONZuz7jRKZtxWLTi1n9gkbYVE,4222
|
|
@@ -31,8 +31,8 @@ socketdev/settings/__init__.py,sha256=CCRAnFWOvm7Hi4LY0gbFqsOFHNDlWK3FHei0Edcv_-
|
|
|
31
31
|
socketdev/threatfeed/__init__.py,sha256=2SsJYKByXBkb2C1fGopwxejkr7mky0kggFKIunyV7Nk,1119
|
|
32
32
|
socketdev/tools/__init__.py,sha256=ROvpEULLXTKby9DMsVFPlAlysjwfop1NhRqSrFUWprY,1969
|
|
33
33
|
socketdev/triage/__init__.py,sha256=-h599vThVetfRSOAs1e4IUoMjcXS8xOsUfub41XPiX4,1559
|
|
34
|
-
socketdev/utils/__init__.py,sha256=
|
|
35
|
-
socketdev-3.0.
|
|
36
|
-
socketdev-3.0.
|
|
37
|
-
socketdev-3.0.
|
|
38
|
-
socketdev-3.0.
|
|
34
|
+
socketdev/utils/__init__.py,sha256=gQBtAdElhpHSjHlB4GIecgJ-1P9aC8azs-eHRlyGCgc,13888
|
|
35
|
+
socketdev-3.0.14.dist-info/METADATA,sha256=y0fZ69AdF7f6VuJYtrhIjLnYvUV8PsCLGsItAmXppCc,36090
|
|
36
|
+
socketdev-3.0.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
37
|
+
socketdev-3.0.14.dist-info/licenses/LICENSE,sha256=mC0II_UuE-_gCG9XqOLNyrV3crnROzMpdAetGnMrhpw,1068
|
|
38
|
+
socketdev-3.0.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|