@@ -429,8 +429,9 @@ Dictionary<string, string> filePathToLayerId
429429 return ( null , [ ] ) ;
430430 }
431431
432- // Collect layer IDs from the artifact's locations.
432+ // Collect layer IDs from the artifact's locations, filtering out entries with null/empty layer IDs .
433433 var locationLayerIds = artifact . Locations ?
434+ . Where ( location => ! string . IsNullOrEmpty ( location . Path ) && ! string . IsNullOrEmpty ( location . LayerId ) )
434435 . Select ( location => ( location . Path , location . LayerId ) )
435436 . ToList ( ) ?? [ ] ;
436437
@@ -440,7 +441,8 @@ Dictionary<string, string> filePathToLayerId
440441 {
441442 foreach ( var file in artifact . Metadata . Files )
442443 {
443- var filePath = file . FileFile ? . Path ;
444+ // The File union type can be either a FileFile object or a plain string path.
445+ var filePath = file . FileFile ? . Path ?? file . String ;
444446 if ( ! string . IsNullOrEmpty ( filePath ) && filePathToLayerId . TryGetValue ( filePath , out var layerId ) )
445447 {
446448 locationLayerIds . Add ( ( filePath , layerId ) ) ;
@@ -464,6 +466,7 @@ Dictionary<string, string> filePathToLayerId
464466 // Fall back to database path layer IDs if no other locations are available.
465467 var allLayerIds = locationLayerIds
466468 . Select ( loc => loc . LayerId )
469+ . Where ( id => ! string . IsNullOrEmpty ( id ) )
467470 . Distinct ( )
468471 . ToList ( ) ;
469472 return ( component , allLayerIds ) ;
0 commit comments