mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 13:16:53 +00:00
GODT-2110: Force attachment disposition if content ID is missing
We now set disposition during attachment upload. However, this presents a problem: some clients use inline disposition but don't provide a content ID. Our API doesn't support this. To mitigate the issue, we just fall back to attachment disposition in this case.
This commit is contained in:
@ -245,6 +245,7 @@ func createDraft(
|
||||
})
|
||||
}
|
||||
|
||||
// nolint:funlen
|
||||
func createAttachments(
|
||||
ctx context.Context,
|
||||
client *liteapi.Client,
|
||||
@ -268,6 +269,12 @@ func createAttachments(
|
||||
return attKey{}, fmt.Errorf("failed to encrypt attachment: %w", err)
|
||||
}
|
||||
|
||||
// Some clients use inline disposition but don't set a content ID. Our API doesn't support this.
|
||||
// We could generate our own content ID, but for simplicity, we just set the disposition to attachment.
|
||||
if att.Disposition == string(liteapi.InlineDisposition) && att.ContentID == "" {
|
||||
att.Disposition = string(liteapi.AttachmentDisposition)
|
||||
}
|
||||
|
||||
attachment, err := client.UploadAttachment(ctx, liteapi.CreateAttachmentReq{
|
||||
Filename: att.Name,
|
||||
MessageID: draftID,
|
||||
|
||||
Reference in New Issue
Block a user