File tree Expand file tree Collapse file tree
src/routes/(console)/project-[region]-[project]/sites/create-site/manual Expand file tree Collapse file tree Original file line number Diff line number Diff line change 138138 }
139139
140140 function handleInvalid(e : CustomEvent ) {
141- const reason = e .detail ?.reason ?? ' ' ;
141+ let reason = e .detail ?.reason ?? ' ' ;
142+
143+ if (! reason ) {
144+ const nativeEvent = e .detail as Event | undefined ;
145+ const input = (nativeEvent ?.currentTarget ?? nativeEvent ?.target ) as
146+ | HTMLInputElement
147+ | undefined ;
148+ const pickedFiles = Array .from (input ?.files ?? []);
149+
150+ if (pickedFiles .some ((file ) => file .size > maxSize )) {
151+ reason = InvalidFileType .SIZE ;
152+ } else if (pickedFiles .some ((file ) => ! file .name .toLowerCase ().endsWith (' .tar.gz' ))) {
153+ reason = InvalidFileType .EXTENSION ;
154+ }
155+ }
156+
142157 if (reason === InvalidFileType .EXTENSION ) {
143158 addNotification ({
144159 type: ' error' ,
147162 } else if (reason === InvalidFileType .SIZE ) {
148163 addNotification ({
149164 type: ' error' ,
150- message: ' File size exceeds 10MB '
165+ message: ` File size exceeds ${ readableMaxSize . value }${ readableMaxSize . unit } `
151166 });
152167 } else {
153168 addNotification ({
You can’t perform that action at this time.
0 commit comments