commit 1963a4e2552f190078a1137fabf322176b4401b6
parent 418413232619d3c882608c7cc4c6b6371f50ec98
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 7 Apr 2023 05:17:04 -0700
prevent crash when path is invalid
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -466,7 +466,7 @@ impl LeChatPHPClient {
}
PostType::Upload(file_path, send_to, msg) => {
form = Some(
- multipart::Form::new()
+ match multipart::Form::new()
.text("lang", LANG.to_owned())
.text("nc", nc_value.to_owned())
.text("session", session.clone())
@@ -475,8 +475,13 @@ impl LeChatPHPClient {
.text("message", msg)
.text("sendto", send_to.to_owned())
.text("what", "purge".to_owned())
- .file("file", file_path)
- .unwrap(),
+ .file("file", file_path) {
+ Ok(f) => f,
+ Err(e) => {
+ log::error!("{:?}", e);
+ break;
+ },
+ }
);
}
PostType::Clean(_, _) => {}