Skip to content
Snippets Groups Projects
Commit a7c1d23b authored by Mike Hommey's avatar Mike Hommey Committed by Ximin Luo
Browse files

Extract libarchive contents with a file extension

Some of the commands running on extracted content, like javap, require a
specific file extension to work, so the original extension is better
preserved.
parent 25fee28c
No related branches found
No related tags found
No related merge requests found
......@@ -222,6 +222,8 @@ class LibarchiveContainer(Archive):
# Keep directory sizes small. could be improved but should be
# good enough for "ordinary" large archives.
dst = os.path.join(tmpdir, str(idx // 4096), str(idx % 4096))
root, ext = os.path.splitext(entry.pathname)
dst += ext
# Maintain a mapping of archive path to the extracted path,
# avoiding the need to sanitise filenames.
self._members[entry.pathname] = dst
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment