Browse Source

Updated dependencies and fixed panic getting icons

Daniel García 6 years ago
parent
commit
c9c3f07171
4 changed files with 211 additions and 166 deletions
  1. 194 153
      Cargo.lock
  2. 8 8
      Cargo.toml
  3. 7 3
      src/api/icons.rs
  4. 2 2
      src/mail.rs

File diff suppressed because it is too large
+ 194 - 153
Cargo.lock


+ 8 - 8
Cargo.toml

@@ -25,13 +25,13 @@ rocket = { version = "0.5.0-dev", features = ["tls"], default-features = false }
 rocket_contrib = "0.5.0-dev"
 
 # HTTP client
-reqwest = "0.9.18"
+reqwest = "0.9.19"
 
 # multipart/form-data support
 multipart = { version = "0.16.1", features = ["server"], default-features = false }
 
 # WebSockets library
-ws = "0.8.1"
+ws = "0.9.0"
 
 # MessagePack library
 rmpv = "0.4.0"
@@ -40,12 +40,12 @@ rmpv = "0.4.0"
 chashmap = "2.2.2"
 
 # A generic serialization/deserialization framework
-serde = "1.0.94"
-serde_derive = "1.0.94"
+serde = "1.0.98"
+serde_derive = "1.0.98"
 serde_json = "1.0.40"
 
 # Logging
-log = "0.4.6"
+log = "0.4.8"
 fern = { version = "0.5.8", features = ["syslog-4"] }
 
 # A safe, extensible ORM and Query builder
@@ -99,14 +99,14 @@ native-tls = "0.2.3"
 quoted_printable = "0.4.1"
 
 # Template library
-handlebars = "2.0.0"
+handlebars = "2.0.1"
 
 # For favicon extraction from main website
 soup = "0.4.1"
-regex = "1.1.9"
+regex = "1.2.0"
 
 # URL encoding library
-percent-encoding = "1.0.1"
+percent-encoding = "2.0.0"
 
 [patch.crates-io]
 # Add support for Timestamp type

+ 7 - 3
src/api/icons.rs

@@ -204,9 +204,13 @@ fn get_icon_url(domain: &str) -> Result<(Vec<Icon>, String), Error> {
         let raw_cookies = content.headers().get_all("set-cookie");
         cookie_str = raw_cookies
             .iter()
-            .map(|raw_cookie| {
-                let cookie = Cookie::parse(raw_cookie.to_str().unwrap_or_default()).unwrap();
-                format!("{}={}; ", cookie.name(), cookie.value())
+            .filter_map(|raw_cookie| raw_cookie.to_str().ok())
+            .map(|cookie_str| {
+                if let Ok(cookie) = Cookie::parse(cookie_str) {
+                    format!("{}={}; ", cookie.name(), cookie.value())
+                } else {
+                    String::new()
+                }
             })
             .collect::<String>();
 

+ 2 - 2
src/mail.rs

@@ -3,7 +3,7 @@ use lettre::smtp::ConnectionReuseParameters;
 use lettre::{ClientSecurity, ClientTlsParameters, SmtpClient, SmtpTransport, Transport};
 use lettre_email::{EmailBuilder, MimeMultipartType, PartBuilder};
 use native_tls::{Protocol, TlsConnector};
-use percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
+use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
 use quoted_printable::encode_to_str;
 
 use crate::api::EmptyResult;
@@ -103,7 +103,7 @@ pub fn send_invite(
             "url": CONFIG.domain(),
             "org_id": org_id.unwrap_or_else(|| "_".to_string()),
             "org_user_id": org_user_id.unwrap_or_else(|| "_".to_string()),
-            "email": percent_encode(address.as_bytes(), DEFAULT_ENCODE_SET).to_string().replace("+", "%2b"),
+            "email": percent_encode(address.as_bytes(), NON_ALPHANUMERIC).to_string(),
             "org_name": org_name,
             "token": invite_token,
         }),

Some files were not shown because too many files changed in this diff