fix: Properly map over user.copyright

This commit is contained in:
Richie Bendall 2019-11-26 22:32:15 +13:00 committed by GitHub
parent 8ff508a547
commit 7f6a8d5dd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,10 +36,10 @@ module.exports = (req, res) => {
if (user.copyright) {
if (_.isString(user.copyright)) {
name = getCopyrightHTML(user, options.format !== 'html');
} else if (user.copyright.every(val => _.isString(val))) {
} else if (_.isArray(user.copyright) && user.copyright.every(val => _.isString(val))) {
// Supports: ['Remy Sharp', 'Richie Bendall']
name = user
.map(_ => (options.format !== 'html' ? _ : escapeTags(_)))
name = user.copyright
.map(v => (options.format !== 'html' ? v : escapeTags(v)))
.join(', ');
} else {
name = user.copyright.map(getCopyrightHTML).join(', ');