mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
parent
a3d8bd1a45
commit
6af5cb9f38
1 changed files with 10 additions and 2 deletions
|
@ -24,8 +24,6 @@ use std::{
|
|||
|
||||
define_newtype!(NoteID, i64);
|
||||
|
||||
// fixme: ensure nulls and x1f not in field contents
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct TransformNoteOutput {
|
||||
pub changed: bool,
|
||||
|
@ -88,6 +86,12 @@ impl Note {
|
|||
)));
|
||||
}
|
||||
|
||||
for field in &mut self.fields {
|
||||
if field.contains(invalid_char_for_field) {
|
||||
*field = field.replace(invalid_char_for_field, "");
|
||||
}
|
||||
}
|
||||
|
||||
if normalize_text {
|
||||
for field in &mut self.fields {
|
||||
ensure_string_in_nfc(field);
|
||||
|
@ -226,6 +230,10 @@ fn anki_base91(mut n: u64) -> String {
|
|||
buf.chars().rev().collect()
|
||||
}
|
||||
|
||||
fn invalid_char_for_field(c: char) -> bool {
|
||||
c.is_ascii_control() && c != '\n' && c != '\t'
|
||||
}
|
||||
|
||||
impl Collection {
|
||||
fn canonify_note_tags(&self, note: &mut Note, usn: Usn) -> Result<()> {
|
||||
if !note.tags.is_empty() {
|
||||
|
|
Loading…
Reference in a new issue