File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
velog-backend/src/router/posts Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ export const updatePost = async (ctx: Context): Promise<*> => {
74
74
75
75
const schema = Joi . object ( ) . keys ( {
76
76
title : Joi . string ( )
77
+ . trim ( )
77
78
. min ( 1 )
78
79
. max ( 120 ) ,
79
80
body : Joi . string ( ) . min ( 1 ) ,
@@ -83,7 +84,10 @@ export const updatePost = async (ctx: Context): Promise<*> => {
83
84
is_temp : Joi . boolean ( ) ,
84
85
categories : Joi . array ( ) . items ( Joi . string ( ) ) ,
85
86
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 ) ,
87
91
meta : Joi . object ( ) ,
88
92
} ) ;
89
93
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ export const writePost = async (ctx: Context): Promise<*> => {
134
134
const schema = Joi . object ( ) . keys ( {
135
135
title : Joi . string ( )
136
136
. required ( )
137
+ . trim ( )
137
138
. min ( 1 )
138
139
. max ( 120 ) ,
139
140
body : Joi . string ( )
@@ -152,7 +153,7 @@ export const writePost = async (ctx: Context): Promise<*> => {
152
153
tags : Joi . array ( )
153
154
. items ( Joi . string ( ) )
154
155
. required ( ) ,
155
- urlSlug : Joi . string ( ) . max ( 130 ) ,
156
+ urlSlug : Joi . string ( ) . trim ( ) . min ( 1 ) . max ( 130 ) ,
156
157
} ) ;
157
158
158
159
if ( ! validateSchema ( ctx , schema ) ) {
You can’t perform that action at this time.
0 commit comments