Skip to content

Commit f547957

Browse files
committed
Closes velopert#34
1 parent 43d8271 commit f547957

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

velog-backend/src/router/posts/post/post.ctrl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const updatePost = async (ctx: Context): Promise<*> => {
7474

7575
const schema = Joi.object().keys({
7676
title: Joi.string()
77+
.trim()
7778
.min(1)
7879
.max(120),
7980
body: Joi.string().min(1),
@@ -83,7 +84,10 @@ export const updatePost = async (ctx: Context): Promise<*> => {
8384
is_temp: Joi.boolean(),
8485
categories: Joi.array().items(Joi.string()),
8586
tags: Joi.array().items(Joi.string()),
86-
url_slug: Joi.string().max(130),
87+
url_slug: Joi.string()
88+
.trim()
89+
.min(1)
90+
.max(130),
8791
meta: Joi.object(),
8892
});
8993

velog-backend/src/router/posts/posts.ctrl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export const writePost = async (ctx: Context): Promise<*> => {
134134
const schema = Joi.object().keys({
135135
title: Joi.string()
136136
.required()
137+
.trim()
137138
.min(1)
138139
.max(120),
139140
body: Joi.string()
@@ -152,7 +153,7 @@ export const writePost = async (ctx: Context): Promise<*> => {
152153
tags: Joi.array()
153154
.items(Joi.string())
154155
.required(),
155-
urlSlug: Joi.string().max(130),
156+
urlSlug: Joi.string().trim().min(1).max(130),
156157
});
157158

158159
if (!validateSchema(ctx, schema)) {

0 commit comments

Comments
 (0)