fix: add check

This commit is contained in:
MomentQYC 2024-11-13 08:37:30 +08:00 committed by GitHub
parent ed80eee3e1
commit d949e4402c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -102,9 +102,16 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
.filter(x => x != null),
);
recipientEMailAddresses.push(
...(this.meta.maintainerEmail ? [this.meta.maintainerEmail] : []),
);
const emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
if (
this.meta.maintainerEmail &&
emailRe.test(this.meta.maintainerEmail) &&
!recipientEMailAddresses.includes(this.meta.maintainerEmail)
) {
recipientEMailAddresses.push(this.meta.maintainerEmail);
}
if (recipientEMailAddresses.length <= 0) {
return;