File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
apps/miiverse-api/src/services/api/routes Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,13 @@ import type { CommunityShotMode, HydratedCommunityDocument } from '@/types/mongo
2727import type { HydratedSettingsDocument } from '@/types/mongoose/settings' ;
2828import type { ParamPack } from '@/types/common/param-pack' ;
2929
30+ // TODO - Is this the best place to put constants like these?
31+ const APP_DATA_MAX_SIZE = 0x400 ; // * Real name is `nn::olv::APP_DATA_MAX_SIZE`
32+
3033const newPostSchema = z . object ( {
3134 community_id : z . string ( ) . optional ( ) ,
32- app_data : z . string ( ) . base64 ( ) . optional ( ) ,
35+ // TODO - This will trigger the generic `ApiErrorCode.BAD_PARAMS` error when the size check fails, is there a specific error code for this case?
36+ app_data : z . string ( ) . base64 ( ) . max ( APP_DATA_MAX_SIZE ) . refine ( ( appData : string ) => Buffer . from ( appData , 'base64' ) . length < APP_DATA_MAX_SIZE ) . optional ( ) ,
3337 painting : z . string ( ) . base64 ( ) . optional ( ) ,
3438 screenshot : z . string ( ) . base64 ( ) . optional ( ) ,
3539 body : z . string ( ) . optional ( ) ,
You can’t perform that action at this time.
0 commit comments