aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorlukeflo2025-05-11 16:00:31 +0200
committerlukeflo2025-05-11 16:00:31 +0200
commit789196d2ed31b5a98fb98e4e5dc9778a7e28bb01 (patch)
tree837fb7379a19f8ca2099664fa9b491d77a0aa18f /src/app.rs
parent5de5793e74193d5c96b75d4cd13703ace1d0104f (diff)
downloadbibiman-789196d2ed31b5a98fb98e4e5dc9778a7e28bb01.tar.gz
bibiman-789196d2ed31b5a98fb98e4e5dc9778a7e28bb01.zip
trim surrounding whitespace of DOI, URL and FILE field: \#20
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/app.rs b/src/app.rs
index 24d9eed..88f37b0 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -378,7 +378,7 @@ pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> {
PathBuf::from(file)
};
- let file = expand_home(&file);
+ let file = expand_home(&file).into_os_string();
// Pass filepath as argument, pipe stdout and stderr to /dev/null
// to keep the TUI clean (where is it piped on Windows???)
@@ -408,13 +408,14 @@ pub fn open_connected_link(cfg: &BibiConfig, link: &str) -> Result<()> {
}
pub fn prepare_weblink(url: &str) -> String {
- if url.starts_with("10.") {
+ let url = if url.starts_with("10.") {
"https://doi.org/".to_string() + url
} else if url.starts_with("www.") {
"https://".to_string() + url
} else {
url.to_string()
- }
+ };
+ url
}
/// Expand leading tilde (`~`) to `/home/user`