summaryrefslogtreecommitdiffstats
path: root/melib/src/email/compose.rs
diff options
context:
space:
mode:
Diffstat (limited to 'melib/src/email/compose.rs')
-rw-r--r--melib/src/email/compose.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/melib/src/email/compose.rs b/melib/src/email/compose.rs
index c78c6ce4..58b583d8 100644
--- a/melib/src/email/compose.rs
+++ b/melib/src/email/compose.rs
@@ -1,11 +1,12 @@
use super::*;
use crate::backends::BackendOp;
use crate::email::attachments::AttachmentBuilder;
+use crate::shellexpand::ShellExpandTrait;
use chrono::{DateTime, Local};
use data_encoding::BASE64_MIME;
use std::ffi::OsStr;
use std::io::Read;
-use std::path::Path;
+use std::path::{Path, PathBuf};
use std::str;
pub mod mime;
@@ -445,12 +446,12 @@ pub fn attachment_from_file<I>(path: &I) -> Result<AttachmentBuilder>
where
I: AsRef<OsStr>,
{
- let path: &Path = Path::new(path);
+ let path: PathBuf = Path::new(path).expand();
if !path.is_file() {
return Err(MeliError::new(format!("{} is not a file", path.display())));
}
- let mut file = std::fs::File::open(path)?;
+ let mut file = std::fs::File::open(&path)?;
let mut contents = Vec::new();
file.read_to_end(&mut contents)?;
let mut attachment = AttachmentBuilder::new(b"");