Browse Source

borg2 archive names and comments are always pure unicode

Thomas Waldmann 2 years ago
parent
commit
491f898612
2 changed files with 4 additions and 4 deletions
  1. 1 1
      src/borg/cache.py
  2. 3 3
      src/borg/helpers/parseformat.py

+ 1 - 1
src/borg/cache.py

@@ -863,7 +863,7 @@ class LocalCache(CacheStatsMixin):
                 )
                 )
                 archive_ids_to_names = get_archive_ids_to_names(archive_ids)
                 archive_ids_to_names = get_archive_ids_to_names(archive_ids)
                 for archive_id, archive_name in archive_ids_to_names.items():
                 for archive_id, archive_name in archive_ids_to_names.items():
-                    pi.show(info=[remove_surrogates(archive_name)])
+                    pi.show(info=[remove_surrogates(archive_name)])  # legacy. borg2 always has pure unicode arch names.
                     if self.do_cache:
                     if self.do_cache:
                         if archive_id in cached_ids:
                         if archive_id in cached_ids:
                             archive_chunk_idx = read_archive_index(archive_id, archive_name)
                             archive_chunk_idx = read_archive_index(archive_id, archive_name)

+ 3 - 3
src/borg/helpers/parseformat.py

@@ -717,7 +717,7 @@ class ArchiveFormatter(BaseFormatter):
         self.call_keys = {
         self.call_keys = {
             "hostname": partial(self.get_meta, "hostname", rs=True),
             "hostname": partial(self.get_meta, "hostname", rs=True),
             "username": partial(self.get_meta, "username", rs=True),
             "username": partial(self.get_meta, "username", rs=True),
-            "comment": partial(self.get_meta, "comment", rs=True),
+            "comment": partial(self.get_meta, "comment", rs=False),
             "end": self.get_ts_end,
             "end": self.get_ts_end,
             "command_line": self.get_cmdline,
             "command_line": self.get_cmdline,
         }
         }
@@ -738,8 +738,8 @@ class ArchiveFormatter(BaseFormatter):
         item_data.update(self.item_data)
         item_data.update(self.item_data)
         item_data.update(
         item_data.update(
             {
             {
-                "name": remove_surrogates(archive_info.name),
-                "archive": remove_surrogates(archive_info.name),
+                "name": archive_info.name,
+                "archive": archive_info.name,
                 "id": bin_to_hex(archive_info.id),
                 "id": bin_to_hex(archive_info.id),
                 "time": self.format_time(archive_info.ts),
                 "time": self.format_time(archive_info.ts),
                 "start": self.format_time(archive_info.ts),
                 "start": self.format_time(archive_info.ts),