@nocobase/plugin-notifications 0.17.0-alpha.7 → 0.18.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.17.0-alpha.7",
3
- "@nocobase/server": "0.17.0-alpha.7",
4
- "@nocobase/database": "0.17.0-alpha.7",
2
+ "@nocobase/client": "0.18.0-alpha.1",
3
+ "@nocobase/server": "0.18.0-alpha.1",
4
+ "@nocobase/database": "0.18.0-alpha.1",
5
5
  "lodash": "4.17.21"
6
6
  };
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2019 Andris Reinman
1
+ Copyright (c) 2011-2023 Andris Reinman
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -91,9 +91,13 @@ class MailComposer {
91
91
  attachment = this._processDataUrl(attachment);
92
92
  }
93
93
 
94
+ let contentType = attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin');
95
+ let isImage = /^image\//i.test(contentType);
96
+ let contentDisposition = attachment.contentDisposition || (isMessageNode || (isImage && attachment.cid) ? 'inline' : 'attachment');
97
+
94
98
  data = {
95
- contentType: attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin'),
96
- contentDisposition: attachment.contentDisposition || (isMessageNode ? 'inline' : 'attachment'),
99
+ contentType,
100
+ contentDisposition,
97
101
  contentTransferEncoding: 'contentTransferEncoding' in attachment ? attachment.contentTransferEncoding : 'base64'
98
102
  };
99
103
 
@@ -506,7 +510,10 @@ class MailComposer {
506
510
  }
507
511
 
508
512
  if (!/^text\//i.test(element.contentType) || element.contentDisposition) {
509
- node.setHeader('Content-Disposition', element.contentDisposition || (element.cid ? 'inline' : 'attachment'));
513
+ node.setHeader(
514
+ 'Content-Disposition',
515
+ element.contentDisposition || (element.cid && /^image\//i.test(element.contentType) ? 'inline' : 'attachment')
516
+ );
510
517
  }
511
518
 
512
519
  if (typeof element.content === 'string' && !['utf8', 'usascii', 'ascii'].includes(encoding)) {