diff --git a/api/dicom-web/controller/UPS-RS/service/cancel.service.js b/api/dicom-web/controller/UPS-RS/service/cancel.service.js index 05a53537..5e6ed5ea 100644 --- a/api/dicom-web/controller/UPS-RS/service/cancel.service.js +++ b/api/dicom-web/controller/UPS-RS/service/cancel.service.js @@ -59,9 +59,10 @@ class CancelWorkItemService extends BaseWorkItemService { async addCancelEvent() { let hitSubscriptions = await this.getHitSubscriptions(this.workItem); - let aeTitles = hitSubscriptions.map(v => v.aeTitle); - - this.addUpsEvent(UPS_EVENT_TYPE.CancelRequested, this.upsInstanceUID, this.cancelRequestBy(), aeTitles); + if (hitSubscriptions.length > 0 ) { + let aeTitles = hitSubscriptions.map(v => v.aeTitle); + this.addUpsEvent(UPS_EVENT_TYPE.CancelRequested, this.upsInstanceUID, this.cancelRequestBy(), aeTitles); + } } cancelRequestBy() { diff --git a/api/dicom-web/controller/UPS-RS/service/create-workItem.service.js b/api/dicom-web/controller/UPS-RS/service/create-workItem.service.js index 75e1c314..d3355c9d 100644 --- a/api/dicom-web/controller/UPS-RS/service/create-workItem.service.js +++ b/api/dicom-web/controller/UPS-RS/service/create-workItem.service.js @@ -86,7 +86,7 @@ class CreateWorkItemService extends BaseWorkItemService { let hitSubscriptions = await this.getHitSubscriptions(workItem); - if (hitSubscriptions) { + if (hitSubscriptions?.length > 0 ) { let hitSubscriptionAeTitleArray = hitSubscriptions.map(sub => sub.aeTitle); this.addUpsEvent(UPS_EVENT_TYPE.StateReport, workItem.upsInstanceUID, this.stateReportOf(await workItem.toDicomJson()), hitSubscriptionAeTitleArray); let assignedEventInformationArray = await this.getAssignedEventInformationArray(