diff --git a/pydevd_file_utils.py b/pydevd_file_utils.py index 92919c4f..e562308d 100644 --- a/pydevd_file_utils.py +++ b/pydevd_file_utils.py @@ -503,6 +503,9 @@ def _apply_func_and_normalize_case(filename, func, isabs, normalize_case, os_pat ind += 4 zip_path = r[:ind] inner_path = r[ind:] + if inner_path and not inner_path.startswith(("!", "/", "\\")): + # Keep paths such as ".zipx/main.py" as regular filesystem paths. + inner_path = "" if inner_path.startswith("!"): # Note (fabioz): although I can replicate this by creating a file ending as # .zip! or .egg!, I don't really know what's the real-world case for this diff --git a/tests_python/test_pydevd_file_utils.py b/tests_python/test_pydevd_file_utils.py new file mode 100644 index 00000000..05d384e8 --- /dev/null +++ b/tests_python/test_pydevd_file_utils.py @@ -0,0 +1,12 @@ +import os + +import pydevd_file_utils + + +def test_normalize_case_does_not_split_dot_zipx_directory(tmpdir): + zipx_dir = tmpdir.mkdir(".zipx") + filename = str(zipx_dir.join("main.py")) + zipx_dir.join("main.py").write("print('ok')\n") + + expected = os.path.abspath(filename) + assert pydevd_file_utils._apply_func_and_normalize_case(filename, os.path.abspath, True, False) == expected