Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
2 changes: 1 addition & 1 deletion unblob/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def open( # noqa: A003

def unlink(self, path):
"""Delete file within extraction path."""
logger.debug("unlink file", file_path=path)
logger.debug("unlink file", file_path=path, _verbosity=3)
safe_path = self._get_extraction_path(path, "unlink")

safe_path.unlink(missing_ok=True)
5 changes: 5 additions & 0 deletions unblob/handlers/archive/cpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ def dump_entries(self, fs: FileSystem):
if entry.path.name in ("", "."):
continue

# There are cases where CPIO archives have duplicated entries
# We then unlink the files to overwrite them and avoid an error.
if not stat.S_ISDIR(entry.mode):
fs.unlink(entry.path)

if stat.S_ISREG(entry.mode):
fs.carve(entry.path, self.file, entry.start_offset, entry.size)
elif stat.S_ISDIR(entry.mode):
Expand Down