aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorlukeflo2025-07-05 22:55:46 +0200
committerlukeflo2025-07-05 22:55:46 +0200
commite2b4e12cf1ce15a26172ac8f2166c5e02ca89351 (patch)
tree111dc459d1d022cf61f7b55c29962a162f381aaa /src/app.rs
parent19672076cf58e12355074b791a55d1d0cddfc7e4 (diff)
downloadbibiman-e2b4e12cf1ce15a26172ac8f2166c5e02ca89351.tar.gz
bibiman-e2b4e12cf1ce15a26172ac8f2166c5e02ca89351.zip
quit creating note function if citekey contains special char
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/app.rs b/src/app.rs
index 01424bc..708ec37 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -427,7 +427,27 @@ impl App {
}
CmdAction::CreateNote => {
if let CurrentArea::EntryArea = self.bibiman.current_area {
- if cfg.general.note_path.is_some()
+ let citekey = self.bibiman.entry_table.entry_table_items[self
+ .bibiman
+ .entry_table
+ .entry_table_state
+ .selected()
+ .unwrap()]
+ .citekey
+ .clone();
+ if citekey.contains("/")
+ | citekey.contains("|")
+ | citekey.contains("#")
+ | citekey.contains("\\")
+ | citekey.contains("*")
+ {
+ self.bibiman.open_popup(
+ PopupKind::MessageError,
+ Some("Selected entrys citekey contains special char: "),
+ Some(&citekey),
+ None,
+ )?;
+ } else if cfg.general.note_path.is_some()
&& cfg.general.note_extensions.is_some()
&& self.bibiman.entry_table.entry_table_items[self
.bibiman
@@ -454,7 +474,7 @@ impl App {
));
}
self.bibiman
- .open_popup(PopupKind::CreateNote, None, None, Some(items));
+ .open_popup(PopupKind::CreateNote, None, None, Some(items))?;
} else if cfg.general.note_path.is_some()
&& self.bibiman.entry_table.entry_table_items[self
.bibiman