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
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
v (next)
--------

- Spaces in filenames are no longer replaced by underscores when files are
extracted from archives.

v21.6.2
-------
Expand Down
2 changes: 1 addition & 1 deletion src/extractcode/libarchive2.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def extract(location, target_dir, skip_symlinks=True):
if TRACE:
logger.debug(' writing.....')

_target_path = entry.write(abs_target_dir, transform_path=paths.safe_path)
_target_path = entry.write(abs_target_dir, transform_path=partial(paths.safe_path, preserve_spaces=True))

return warnings

Expand Down
2 changes: 1 addition & 1 deletion src/extractcode/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def extract(location, target_dir):

# make the path safe to use as a subfile path
# ensure this a good and clean posix relative path
patch_subfile_path = paths.safe_path(patch_subfile_path)
patch_subfile_path = paths.safe_path(patch_subfile_path, preserve_spaces=True)

# create directories
parent_dir = posixpath.dirname(patch_subfile_path)
Expand Down
2 changes: 1 addition & 1 deletion src/extractcode/sevenzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def extract_file_by_file(
errors[entry.path] = 'No file name extracted.'
continue

safe_path = paths.safe_path(entry.path, posix=True)
safe_path = paths.safe_path(entry.path, posix=True, preserve_spaces=True)
target_file_loc = os.path.join(target_dir, safe_path)
target_file_dir = os.path.dirname(target_file_loc)
fileutils.create_dir(target_file_dir)
Expand Down
Loading