File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,12 @@ async function _verifySHX(shx, passcode) {
167
167
for ( const i in resolved . rawBundles ) {
168
168
addRawBundle ( statusObj , resolved . rawBundles [ i ] ) ;
169
169
}
170
-
170
+ // Check if the 'section' field is missing or empty in each FHIR bundle
171
+ statusObj . bundles . forEach ( bundle => {
172
+ if ( ! bundle . fhir || ! bundle . fhir . entry || ! bundle . fhir . entry . some ( entry => entry . resource && entry . resource . section ) ) {
173
+ throw new DataMissingError ( "The provided Smart Health Link does not contain any healthcare data." ) ;
174
+ }
175
+ } ) ;
171
176
// build up our organized resources
172
177
const labelCounters = { } ;
173
178
for ( const i in statusObj . bundles ) {
@@ -240,11 +245,6 @@ async function resolveSHX(shx, passcode) {
240
245
// wasn't JSON, so assume it's an SHC... we'll error on verification if not
241
246
resolved . verifiableCredentials . push ( target ) ;
242
247
}
243
- // Throw DataMissingError if no data found
244
- if ( resolved . verifiableCredentials . length === 0 && resolved . rawBundles . length === 0 ) {
245
- throw new DataMissingError ( "No data found in the SHL content." ) ;
246
- }
247
-
248
248
return ( resolved ) ;
249
249
}
250
250
You can’t perform that action at this time.
0 commit comments