Skip to content

Commit ddaa826

Browse files
author
Andrew Fasano
committed
Convert paths to string for tarinfo
1 parent a5c66e1 commit ddaa826

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

unblob/handlers/archive/_safe_tarfile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def extract(self, tarinfo: tarfile.TarInfo, extract_root: Path): # noqa: C901
112112
)
113113

114114
# The symlink will point to our relative target (may be updated below if unsafe)
115-
tarinfo.linkname = rel_target
115+
tarinfo.linkname = rel_target.as_posix()
116116
logger.info(
117117
"Link target is relative", linkname=tarinfo.linkname, name=tarinfo.name
118118
)
@@ -160,7 +160,7 @@ def extract(self, tarinfo: tarfile.TarInfo, extract_root: Path): # noqa: C901
160160
# Prepend placeholder directories before rel_target to get a valid path
161161
# within extract_root. This is the relative version of resolved_path.
162162
rel_target = Path("/".join(["placeholder"] * drop_count)) / rel_target
163-
tarinfo.linkname = rel_target
163+
tarinfo.linkname = rel_target.as_posix()
164164

165165
logger.debug("Creating symlink", points_to=resolved_path, name=tarinfo.name)
166166

0 commit comments

Comments
 (0)