Skip to content

Commit 6b28a7b

Browse files
committed
fix: avoid splitting .zipx paths as zip files
1 parent d6bc5f5 commit 6b28a7b

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

pydevd_file_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ def _apply_func_and_normalize_case(filename, func, isabs, normalize_case, os_pat
503503
ind += 4
504504
zip_path = r[:ind]
505505
inner_path = r[ind:]
506+
if inner_path and not inner_path.startswith(("!", "/", "\\")):
507+
# Keep paths such as ".zipx/main.py" as regular filesystem paths.
508+
inner_path = ""
506509
if inner_path.startswith("!"):
507510
# Note (fabioz): although I can replicate this by creating a file ending as
508511
# .zip! or .egg!, I don't really know what's the real-world case for this
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
3+
import pydevd_file_utils
4+
5+
6+
def test_normalize_case_does_not_split_dot_zipx_directory(tmpdir):
7+
zipx_dir = tmpdir.mkdir(".zipx")
8+
filename = str(zipx_dir.join("main.py"))
9+
zipx_dir.join("main.py").write("print('ok')\n")
10+
11+
expected = os.path.abspath(filename)
12+
assert pydevd_file_utils._apply_func_and_normalize_case(filename, os.path.abspath, True, False) == expected

0 commit comments

Comments
 (0)