Skip to content

Commit 80c1466

Browse files
committed
Log disallowed attachment name.
1 parent 28a34fe commit 80c1466

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

services/mailer/incoming/incoming_handler.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, user *u
3939
return fmt.Errorf("user needed")
4040
}
4141

42-
if content.Content == "" && len(content.Attachments) == 0 {
43-
return nil
44-
}
45-
4642
ref, err := incoming_payload.GetReferenceFromPayload(ctx, payload)
4743
if err != nil {
4844
return err
@@ -91,7 +87,7 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, user *u
9187
})
9288
if err != nil {
9389
if upload.IsErrFileTypeForbidden(err) {
94-
log.Debug("Skipping disallowed attachment type")
90+
log.Info("Skipping disallowed attachment type: %s", attachment.Name)
9591
continue
9692
}
9793
return err
@@ -100,13 +96,21 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, user *u
10096
}
10197
}
10298

99+
if content.Content == "" && len(attachmentIDs) == 0 {
100+
return nil
101+
}
102+
103103
_, err = issue_service.CreateIssueComment(ctx, user, issue.Repo, issue, content.Content, attachmentIDs)
104104
if err != nil {
105105
return fmt.Errorf("CreateIssueComment failed: %w", err)
106106
}
107107
case *issues_model.Comment:
108108
comment := r
109109

110+
if content.Content == "" {
111+
return nil
112+
}
113+
110114
if comment.Type == issues_model.CommentTypeCode {
111115
_, err := pull_service.CreateCodeComment(
112116
ctx,

0 commit comments

Comments
 (0)