fix(mail(js)): parse all parameters of mailto: link

Fixes #5478
This commit is contained in:
Francis Lachapelle
2022-02-08 13:09:27 -05:00
parent 3ef9002894
commit fa598e83ee

View File

@@ -662,7 +662,7 @@
action = 'markMessageUncollapse';
this.collapsed = !this.collapsed;
_this.$mailbox.updateVisibleMessages();
this.$mailbox.updateVisibleMessages();
return Message.$$resource.post(this.$absolutePath(), action).catch(function() {
this.collapsed = !this.collapsed;
@@ -717,32 +717,33 @@
* information parsed from the specified "mailto:" link.
*/
Message.prototype.$parseMailto = function(mailto) {
var to, data, match = /^mailto:([^\?]+)/.exec(mailto);
var to, data = {}, match = /^mailto:([^\?]+)/.exec(mailto);
if (match) {
// Recipients
to = _.map(decodeURIComponent(match[1]).split(','), function(email) {
return '<' + email.trim() + '>';
});
data = { to: to };
// Subject & body
_.forEach(['subject', 'body'], function(param) {
var re = new RegExp(param + '=([^&]+)');
param = (param == 'body')? 'text' : param;
match = re.exec(mailto);
if (match)
data[param] = decodeURIComponent(match[1]);
});
// Other Recipients
_.forEach(['cc', 'bcc'], function(param) {
var re = new RegExp(param + '=([^&]+)');
match = re.exec(mailto);
if (match)
data[param] = _.map(decodeURIComponent(match[1]).split(','), function(email) {
return '<' + email.trim() + '>';
});
});
angular.extend(this.editable, data);
}
// Subject & body
_.forEach(['subject', 'body'], function(param) {
var re = new RegExp(param + '=([^&]+)');
param = (param == 'body')? 'text' : param;
match = re.exec(mailto);
if (match)
data[param] = decodeURIComponent(match[1]);
});
// Other Recipients
_.forEach(['cc', 'bcc'], function(param) {
var re = new RegExp(param + '=([^&]+)');
match = re.exec(mailto);
if (match)
data[param] = _.map(decodeURIComponent(match[1]).split(','), function(email) {
return '<' + email.trim() + '>';
});
});
if (!_.isEmpty(data))
angular.extend(this.editable, data);
};
/**