Skip to content

Commit

Permalink
Add assert to make issue pypa#1949 more apparent
Browse files Browse the repository at this point in the history
  • Loading branch information
petamas committed Jul 20, 2023
1 parent 0114a68 commit 2fde5c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/virtualenv/util/zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def extract(full_path, dest):

def _get_path_within_zip(full_path):
full_path = os.path.abspath(str(full_path))
sub_file = full_path[len(ROOT) + 1 :]
prefix = ROOT + os.sep
assert full_path.startswith(prefix), f"full_path={full_path} should start with prefix={prefix}"
sub_file = full_path[len(prefix) :]
if IS_WIN:
# paths are always UNIX separators, even on Windows, though __file__ still follows platform default
sub_file = sub_file.replace(os.sep, "/")
Expand Down

0 comments on commit 2fde5c4

Please sign in to comment.