mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
Handle encoding in replace_media_refs()
This commit is contained in:
parent
7583a7e6b3
commit
cd4865dd18
1 changed files with 6 additions and 1 deletions
|
@ -255,7 +255,12 @@ pub(crate) fn replace_media_refs(
|
|||
let mut rep = |caps: &Captures| {
|
||||
let whole_match = caps.get(0).unwrap().as_str();
|
||||
let old_name = caps.iter().skip(1).find_map(|g| g).unwrap().as_str();
|
||||
if let Some(new_name) = replacer(old_name) {
|
||||
let old_name_decoded = decode_entities(old_name);
|
||||
|
||||
if let Some(mut new_name) = replacer(&old_name_decoded) {
|
||||
if matches!(old_name_decoded, Cow::Owned(_)) {
|
||||
new_name = htmlescape::encode_minimal(&new_name);
|
||||
}
|
||||
whole_match.replace(old_name, &new_name)
|
||||
} else {
|
||||
whole_match.to_owned()
|
||||
|
|
Loading…
Reference in a new issue