Skip to content

Commit

Permalink
fixed ignored_files does not work when using tar
Browse files Browse the repository at this point in the history
this might be the cause of #41
  • Loading branch information
Fallen-Breath committed Jul 27, 2023
1 parent 1b3deb6 commit 413b75f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions quick_backup_multi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ def copy_worlds(src: str, dst: str, intent: CopyWorldIntent, *, backup_format: O
server_inst.logger.info('storing {} -> {}'.format(src_path, tar_path))
if os.path.exists(src_path):
def tar_filter(info: tarfile.TarInfo) -> Optional[tarfile.TarInfo]:
if config.is_file_ignored(info.name):
return None
return info
ignored = config.is_file_ignored(os.path.basename(info.name))
server_inst.logger.debug('tar_filter ignore {}: {}'.format(info.name, ignored))
return None if ignored else info

backup_file.add(src_path, arcname=world, filter=tar_filter)
else:
server_inst.logger.warning('{} does not exist while storing'.format(src_path))
Expand Down

0 comments on commit 413b75f

Please sign in to comment.