File tree Expand file tree Collapse file tree
apps/web/src/features/upload Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -484,14 +484,16 @@ export async function processInstrumentCSV(
484484 //TODO make this type safe without having to cast z.AnyZodObject
485485 instrumentSchemaWithInternal = ( instrumentSchemaDef . schema as z . AnyZodObject ) . extend ( {
486486 date : z . coerce . date ( ) ,
487- subjectID : z . string ( ) . regex ( / ^ [ ^ $ ] + $ / , 'Subject ID has to be at least 1 character long and without a $' )
487+ subjectID : z
488+ . string ( )
489+ . regex ( / ^ [ ^ $ \s ] + $ / , 'Subject ID has to be at least 1 character long, without a $ and no whitespaces' )
488490 } ) ;
489491
490492 shape = instrumentSchemaWithInternal . _def . shape ( ) as { [ key : string ] : z . ZodTypeAny } ;
491493 } else {
492494 instrumentSchemaWithInternal = instrumentSchema . extend ( {
493495 date : z . coerce . date ( ) ,
494- subjectID : z . string ( ) . regex ( / ^ [ ^ $ ] + $ / , 'Subject ID has to be at least 1 character long and without a $' )
496+ subjectID : z . string ( ) . regex ( / ^ [ ^ $ \s ] + $ / , 'Subject ID has to be at least 1 character long and without a $' )
495497 } ) ;
496498 shape = instrumentSchemaWithInternal . shape as { [ key : string ] : z . ZodTypeAny } ;
497499 }
@@ -526,7 +528,7 @@ export async function processInstrumentCSV(
526528 const jsonLine : { [ key : string ] : unknown } = { } ;
527529 for ( let j = 0 ; j < headers . length ; j ++ ) {
528530 const key = headers [ j ] ! ;
529- const rawValue = elements [ j ] ! ;
531+ const rawValue = elements [ j ] ! . trim ( ) ;
530532
531533 if ( rawValue === '\n' ) {
532534 continue ;
You can’t perform that action at this time.
0 commit comments