Merge pull request #505 from openpgpjs/user_id_formatting

don't allow leading spaces when generating userid
This commit is contained in:
Bart Butler 2016-12-15 14:15:57 -08:00 committed by GitHub
commit 5ffb532f9e
2 changed files with 6 additions and 2 deletions

View File

@ -391,6 +391,10 @@ function formatUserIds(options) {
if (!util.isString(id.name) || (id.email && !util.isEmailAddress(id.email))) {
throw new Error('Invalid user id format');
}
id.name = id.name.trim();
if (id.name.length > 0) {
id.name += ' ';
}
return id.name + '<' + id.email + '>';
});
return options;