浏览代码

mailcap: don't drop File before opening it

Created temporary file was incorrectly set to be deleted on Drop, but
this is not what we want to do when spawning an external command and pass
the file as the argument.

Fixes: #548 ("mailcap handling")

Resolves: <https://git.meli-email.org/meli/meli/issues/548>
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Manos Pitsidianakis 7 月之前
父节点
当前提交
84564f44
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      meli/src/mailcap.rs

+ 3 - 3
meli/src/mailcap.rs

@@ -167,14 +167,14 @@ impl MailcapEntry {
                     .map(|arg| match *arg {
                     .map(|arg| match *arg {
                         "%s" => {
                         "%s" => {
                             needs_stdin = false;
                             needs_stdin = false;
-                            let _f = File::create_temp_file(
+                            let file = File::create_temp_file(
                                 &a.decode(Default::default()),
                                 &a.decode(Default::default()),
                                 None,
                                 None,
                                 None,
                                 None,
                                 None,
                                 None,
-                                true,
+                                false,
                             )?;
                             )?;
-                            let p = _f.path().display().to_string();
+                            let p = file.path().display().to_string();
                             Ok(p)
                             Ok(p)
                         }
                         }
                         "%t" => Ok(a.content_type().to_string()),
                         "%t" => Ok(a.content_type().to_string()),