mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
Pass escaped name to bulk_update in rename_tag
This commit is contained in:
parent
831942c2e2
commit
2ff584c44d
1 changed files with 3 additions and 3 deletions
|
@ -87,11 +87,11 @@ class TagManager:
|
||||||
def rename_tag(self, old: str, new: str) -> int:
|
def rename_tag(self, old: str, new: str) -> int:
|
||||||
"Rename provided tag, returning number of changed notes."
|
"Rename provided tag, returning number of changed notes."
|
||||||
escaped_name = re.sub(r"[*_\\]", r"\\\g<0>", old)
|
escaped_name = re.sub(r"[*_\\]", r"\\\g<0>", old)
|
||||||
escaped_name = '"{}"'.format(escaped_name.replace('"', '\\"'))
|
quote_escaped = escaped_name.replace('"', '\\"')
|
||||||
nids = self.col.find_notes("tag:" + escaped_name)
|
nids = self.col.find_notes(f'tag:"{quote_escaped}"')
|
||||||
if not nids:
|
if not nids:
|
||||||
return 0
|
return 0
|
||||||
return self.col.tags.bulk_update(nids, old, new, False)
|
return self.bulk_update(nids, escaped_name, new, False)
|
||||||
|
|
||||||
# legacy routines
|
# legacy routines
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue