[fractal] Fixes unchecked bug in e52fca475cc4b0ed1db1a1acfba18fd1159590a0



commit 0bd8a9f6bae6608c12ab0dc91953952b8a26898a
Author: Alejandro Domínguez <adomu net-c com>
Date:   Wed Jan 2 18:35:38 2019 +0100

    Fixes unchecked bug in e52fca475cc4b0ed1db1a1acfba18fd1159590a0

 fractal-matrix-api/src/backend/register.rs | 1 -
 fractal-matrix-api/src/util.rs             | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/fractal-matrix-api/src/backend/register.rs b/fractal-matrix-api/src/backend/register.rs
index 8623dfc4..4c19ac54 100644
--- a/fractal-matrix-api/src/backend/register.rs
+++ b/fractal-matrix-api/src/backend/register.rs
@@ -1,4 +1,3 @@
-use regex::Regex;
 use serde_json::Value as JsonValue;
 
 use std::thread;
diff --git a/fractal-matrix-api/src/util.rs b/fractal-matrix-api/src/util.rs
index 91242d79..88dc23e1 100644
--- a/fractal-matrix-api/src/util.rs
+++ b/fractal-matrix-api/src/util.rs
@@ -534,8 +534,9 @@ pub fn dw_media(
     w: i32,
     h: i32,
 ) -> Result<String, Error> {
-    let re = Regex::new(r"mxc://(?P<server>[^/]+)/(?P<media>.+)")?;
-    let caps = re.captures(url).ok_or(Error::BackendError)?;
+    let caps = globals::MATRIX_RE
+        .captures(url)
+        .ok_or(Error::BackendError)?;
     let server = String::from(&caps["server"]);
     let media = String::from(&caps["media"]);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]