From 47c3b54d1d0b276fb87d1b4b71a584e0e0c7b43d Mon Sep 17 00:00:00 2001 From: Vika Shleina Date: Mon, 19 Jul 2021 10:32:42 +0300 Subject: Relaxed anti-takeover URL check to simply not place redirects at foreign URLs --- src/database/redis/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/database/redis/mod.rs') diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs index e64120f..c331e47 100644 --- a/src/database/redis/mod.rs +++ b/src/database/redis/mod.rs @@ -180,7 +180,7 @@ impl Storage for RedisStorage { .collect::>()) } - async fn put_post<'a>(&self, post: &'a serde_json::Value) -> Result<()> { + async fn put_post<'a>(&self, post: &'a serde_json::Value, user: &'a str) -> Result<()> { let mut conn = self.redis.get().await?; let key: &str; match post["properties"]["uid"][0].as_str() { @@ -201,7 +201,7 @@ impl Storage for RedisStorage { .iter() .map(|i| i.as_str().unwrap().to_string()) { - if url != key { + if url != key && url.starts_with(user) { conn.hset::<&str, &str, String, ()>( &"posts", &url, -- cgit 1.4.1