Browse Source

Merge pull request #4637 from elho/second-archive-placeholder-maint

Enable placeholder usage in all extra archive arguments
TW 6 years ago
parent
commit
52c6b92598
2 changed files with 3 additions and 4 deletions
  1. 2 4
      src/borg/archiver.py
  2. 1 0
      src/borg/helpers.py

+ 2 - 4
src/borg/archiver.py

@@ -1238,8 +1238,7 @@ class Archiver:
     @with_archive
     def do_rename(self, args, repository, manifest, key, cache, archive):
         """Rename an existing archive"""
-        name = replace_placeholders(args.name)
-        archive.rename(name)
+        archive.rename(args.name)
         manifest.write()
         repository.commit()
         cache.commit()
@@ -1706,11 +1705,10 @@ class Archiver:
 
         if args.location.archive:
             name = args.location.archive
-            target = replace_placeholders(args.target) if args.target else None
             if recreater.is_temporary_archive(name):
                 self.print_error('Refusing to work on temporary archive of prior recreate: %s', name)
                 return self.exit_code
-            if not recreater.recreate(name, args.comment, target):
+            if not recreater.recreate(name, args.comment, args.target):
                 self.print_error('Nothing to do. Archive was not processed.\n'
                                  'Specify at least one pattern, PATH, --comment, re-compression or re-chunking option.')
         else:

+ 1 - 0
src/borg/helpers.py

@@ -1203,6 +1203,7 @@ def location_validator(archive=None, proto=None):
 
 def archivename_validator():
     def validator(text):
+        text = replace_placeholders(text)
         if '/' in text or '::' in text or not text:
             raise argparse.ArgumentTypeError('Invalid repository name: "%s"' % text)
         return text