/:id route now accepts 7 character post IDs.
This commit is contained in:
elliot 2023-01-01 17:06:58 -06:00 committed by GitHub
parent 9c938c6210
commit 6cf3748642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -289,7 +289,7 @@ async fn main() {
Some("best" | "hot" | "new" | "top" | "rising" | "controversial") => subreddit::community(req).await,
// Short link for post
Some(id) if (5..7).contains(&id.len()) => match canonical_path(format!("/{}", id)).await {
Some(id) if (5..8).contains(&id.len()) => match canonical_path(format!("/{}", id)).await {
Ok(path_opt) => match path_opt {
Some(path) => Ok(redirect(path)),
None => error(req, "Post ID is invalid. It may point to a post on a community that has been banned.").await,