@@ -359,7 +359,19 @@ fn check_onlist_files_exist(
359359 match ol. urltype . as_str ( ) {
360360 "local" => {
361361 let mut candidates: Vec < PathBuf > = Vec :: new ( ) ;
362- let locator = utils:: local_onlist_locator ( & ol) ;
362+ let locator = match utils:: local_onlist_locator ( & ol) {
363+ Ok ( locator) => locator,
364+ Err ( err) => {
365+ push_error (
366+ & mut errors,
367+ & mut idx,
368+ "check_onlist_files_exist" ,
369+ err,
370+ "onlist" ,
371+ ) ;
372+ continue ;
373+ }
374+ } ;
363375 let p = PathBuf :: from ( locator) ;
364376 candidates. push ( if let Some ( base) = spec_base {
365377 if p. is_absolute ( ) {
@@ -439,7 +451,20 @@ fn check_read_files_exist(
439451 for f in & read. files {
440452 match f. urltype . as_str ( ) {
441453 "local" => {
442- let p = PathBuf :: from ( & f. url ) ;
454+ let locator = match utils:: local_resource_url ( & f. url , & f. filename , "file" ) {
455+ Ok ( locator) => locator,
456+ Err ( err) => {
457+ push_error (
458+ & mut errors,
459+ & mut idx,
460+ "check_read_files_exist" ,
461+ err,
462+ "file" ,
463+ ) ;
464+ continue ;
465+ }
466+ } ;
467+ let p = PathBuf :: from ( locator) ;
443468 let full = if let Some ( base) = spec_base {
444469 if p. is_absolute ( ) {
445470 p. clone ( )
@@ -993,6 +1018,40 @@ mod tests {
9931018 ) ;
9941019 }
9951020
1021+ #[ test]
1022+ fn test_check_onlist_files_exist_errors_when_local_url_is_empty ( ) {
1023+ let spec_path = PathBuf :: from ( "tests/fixtures/onlist_read_clip/spec.yaml" ) ;
1024+ let mut spec = load_spec ( & spec_path) ;
1025+ let barcode_region = spec
1026+ . library_spec
1027+ . get_mut ( 0 )
1028+ . unwrap ( )
1029+ . regions
1030+ . iter_mut ( )
1031+ . find ( |region| region. region_id == "barcode_a" )
1032+ . unwrap ( ) ;
1033+ barcode_region. onlist . as_mut ( ) . unwrap ( ) . url . clear ( ) ;
1034+
1035+ let diagnostics = seqspec_check ( & spec, None , & spec_path) ;
1036+ assert ! ( diagnostics. iter( ) . any( |diagnostic| {
1037+ diagnostic. error_type == "check_onlist_files_exist"
1038+ && diagnostic. error_message == "local onlist 'barcode_a.txt' has empty url"
1039+ } ) ) ;
1040+ }
1041+
1042+ #[ test]
1043+ fn test_check_read_files_exist_errors_when_local_url_is_empty ( ) {
1044+ let spec_path = PathBuf :: from ( "tests/fixtures/onlist_read_clip/spec.yaml" ) ;
1045+ let mut spec = load_spec ( & spec_path) ;
1046+ spec. sequence_spec [ 0 ] . files [ 0 ] . url . clear ( ) ;
1047+
1048+ let diagnostics = seqspec_check ( & spec, None , & spec_path) ;
1049+ assert ! ( diagnostics. iter( ) . any( |diagnostic| {
1050+ diagnostic. error_type == "check_read_files_exist"
1051+ && diagnostic. error_message == "local file 'rna_read.fastq.gz' has empty url"
1052+ } ) ) ;
1053+ }
1054+
9961055 #[ test]
9971056 fn test_error_obj_structure ( ) {
9981057 let e = ErrorObj {
0 commit comments