@@ -77,7 +77,7 @@ import { DateTime } from "~/components/primitives/DateTime";
7777import { TextLink } from "~/components/primitives/TextLink" ;
7878import { cn } from "~/utils/cn" ;
7979import { ProjectSettingsPresenter } from "~/services/projectSettingsPresenter.server" ;
80- import { BuildSettings , BuildSettingsSchema } from "~/v3/buildSettings" ;
80+ import { type BuildSettings } from "~/v3/buildSettings" ;
8181
8282export const meta : MetaFunction = ( ) => {
8383 return [
@@ -159,9 +159,32 @@ const UpdateGitSettingsFormSchema = z.object({
159159
160160const UpdateBuildSettingsFormSchema = z . object ( {
161161 action : z . literal ( "update-build-settings" ) ,
162- triggerConfigFilePath : z . string ( ) . trim ( ) . optional ( ) ,
163- installDirectory : z . string ( ) . trim ( ) . optional ( ) ,
164- installCommand : z . string ( ) . trim ( ) . optional ( ) ,
162+ triggerConfigFilePath : z
163+ . string ( )
164+ . trim ( )
165+ . optional ( )
166+ . transform ( ( val ) => ( val ? val . replace ( / ^ \/ + / , "" ) : val ) )
167+ . refine ( ( val ) => ! val || val . length <= 255 , {
168+ message : "Config file path must not exceed 255 characters" ,
169+ } ) ,
170+ installDirectory : z
171+ . string ( )
172+ . trim ( )
173+ . optional ( )
174+ . transform ( ( val ) => ( val ? val . replace ( / ^ \/ + / , "" ) : val ) )
175+ . refine ( ( val ) => ! val || val . length <= 255 , {
176+ message : "Install directory must not exceed 255 characters" ,
177+ } ) ,
178+ installCommand : z
179+ . string ( )
180+ . trim ( )
181+ . optional ( )
182+ . refine ( ( val ) => ! val || ! val . includes ( "\n" ) , {
183+ message : "Install command must be a single line" ,
184+ } )
185+ . refine ( ( val ) => ! val || val . length <= 500 , {
186+ message : "Install command must not exceed 500 characters" ,
187+ } ) ,
165188} ) ;
166189
167190type UpdateBuildSettingsFormSchema = z . infer < typeof UpdateBuildSettingsFormSchema > ;
@@ -1127,7 +1150,7 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings })
11271150 onChange = { ( e ) => {
11281151 setBuildSettingsValues ( ( prev ) => ( {
11291152 ...prev ,
1130- triggerConfigFile : e . target . value ,
1153+ triggerConfigFilePath : e . target . value ,
11311154 } ) ) ;
11321155 } }
11331156 />
@@ -1164,7 +1187,7 @@ function BuildSettingsForm({ buildSettings }: { buildSettings: BuildSettings })
11641187 onChange = { ( e ) => {
11651188 setBuildSettingsValues ( ( prev ) => ( {
11661189 ...prev ,
1167- rootDirectory : e . target . value ,
1190+ installDirectory : e . target . value ,
11681191 } ) ) ;
11691192 } }
11701193 />
0 commit comments