fix: slug capitalization everywhere
This commit is contained in:
parent
c7bc6bb475
commit
d9be04a6fe
1 changed files with 12 additions and 6 deletions
|
@ -127,10 +127,12 @@ pub struct ViewQuery {
|
|||
|
||||
async fn view_request(
|
||||
Extension(data): Extension<State>,
|
||||
Path(slug): Path<String>,
|
||||
Path(mut slug): Path<String>,
|
||||
Query(props): Query<ViewQuery>,
|
||||
) -> impl IntoResponse {
|
||||
let (ref data, ref tera, ref build_code) = *data.read().await;
|
||||
slug = slug.to_lowercase();
|
||||
|
||||
let entry = match data
|
||||
.query(&SimplifiedQuery {
|
||||
query: AppDataSelectQuery::KeyIs(format!("entries('{}')", slug.to_lowercase())),
|
||||
|
@ -226,10 +228,12 @@ async fn view_request(
|
|||
|
||||
async fn editor_request(
|
||||
Extension(data): Extension<State>,
|
||||
Path(slug): Path<String>,
|
||||
Path(mut slug): Path<String>,
|
||||
Query(props): Query<ViewQuery>,
|
||||
) -> impl IntoResponse {
|
||||
let (ref data, ref tera, ref build_code) = *data.read().await;
|
||||
slug = slug.to_lowercase();
|
||||
|
||||
let entry = match data
|
||||
.query(&SimplifiedQuery {
|
||||
query: AppDataSelectQuery::KeyIs(format!("entries('{}')", slug.to_lowercase())),
|
||||
|
@ -305,16 +309,17 @@ async fn render_request(Json(req): Json<RenderMarkdown>) -> impl IntoResponse {
|
|||
|
||||
async fn exists_request(
|
||||
Extension(data): Extension<State>,
|
||||
Path(slug): Path<String>,
|
||||
Path(mut slug): Path<String>,
|
||||
) -> impl IntoResponse {
|
||||
let (ref data, _, _) = *data.read().await;
|
||||
slug = slug.to_lowercase();
|
||||
|
||||
Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "Success".to_string(),
|
||||
payload: data
|
||||
.query(&SimplifiedQuery {
|
||||
query: AppDataSelectQuery::KeyIs(format!("entries('{}')", slug.to_lowercase())),
|
||||
query: AppDataSelectQuery::KeyIs(format!("entries('{}')", slug)),
|
||||
mode: AppDataSelectMode::One(0),
|
||||
})
|
||||
.await
|
||||
|
@ -376,7 +381,7 @@ fn hash_passwords(metadata: &mut EntryMetadata) -> (bool, String) {
|
|||
}
|
||||
|
||||
/// The time that must be waited between each entry creation.
|
||||
const CREATE_WAIT_TIME: usize = 5000;
|
||||
const CREATE_WAIT_TIME: usize = 15000;
|
||||
|
||||
async fn create_request(
|
||||
jar: CookieJar,
|
||||
|
@ -544,10 +549,11 @@ struct EditEntry {
|
|||
async fn edit_request(
|
||||
headers: HeaderMap,
|
||||
Extension(data): Extension<State>,
|
||||
Path(slug): Path<String>,
|
||||
Path(mut slug): Path<String>,
|
||||
Json(mut req): Json<EditEntry>,
|
||||
) -> impl IntoResponse {
|
||||
let (ref data, _, _) = *data.read().await;
|
||||
slug = slug.to_lowercase();
|
||||
|
||||
// get real ip
|
||||
let real_ip = headers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue