clear_tag() should be case-insensitive

This commit is contained in:
abdo 2021-01-18 03:52:28 +03:00
parent dbd0334f97
commit 0ac97cf358
2 changed files with 2 additions and 2 deletions

View file

@ -68,7 +68,7 @@ impl SqliteStorage {
pub(crate) fn clear_tag(&self, tag: &str) -> Result<()> { pub(crate) fn clear_tag(&self, tag: &str) -> Result<()> {
self.db self.db
.prepare_cached("delete from tags where tag regexp ?")? .prepare_cached("delete from tags where tag regexp ?")?
.execute(&[format!("^{}($|::)", regex::escape(tag))])?; .execute(&[format!("(?i)^{}($|::)", regex::escape(tag))])?;
Ok(()) Ok(())
} }

View file

@ -435,7 +435,7 @@ mod test {
// tag children are also cleared when clearing their parent // tag children are also cleared when clearing their parent
col.storage.clear_tags()?; col.storage.clear_tags()?;
for name in vec!["a", "a::b", "a::b::c"] { for name in vec!["a", "a::b", "A::b::c"] {
col.register_tag(Tag::new(name.to_string(), Usn(0)))?; col.register_tag(Tag::new(name.to_string(), Usn(0)))?;
} }
col.storage.clear_tag("a")?; col.storage.clear_tag("a")?;