mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-11 00:49:38 +00:00
Better handle redirects with new OAuth endpoints
This commit is contained in:
parent
3a4a39f577
commit
45d8f1bbc8
4 changed files with 25 additions and 4 deletions
|
@ -335,7 +335,10 @@ async fn main() {
|
|||
match req.param("id").as_deref() {
|
||||
// Share link
|
||||
Some(id) if (8..12).contains(&id.len()) => match canonical_path(format!("/r/{}/s/{}", sub, id)).await {
|
||||
Ok(Some(path)) => Ok(redirect(path.split('?').next().unwrap_or_default().to_string())),
|
||||
Ok(Some(path)) => {
|
||||
// Remove share parameters here.
|
||||
Ok(redirect(path.split('?').next().unwrap_or_default().to_string()))
|
||||
}
|
||||
Ok(None) => error(req, "Post ID is invalid. It may point to a post on a community that has been banned.").await,
|
||||
Err(e) => error(req, e).await,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue