Bugfix: Scope that is "" should result in empty array

This commit is contained in:
Nils Norman Haukås 2018-07-25 19:00:50 +02:00
parent e5a3c7422b
commit 0f5b8e8de5
No known key found for this signature in database
GPG key ID: BB8DD87F83E1359E

View file

@ -27,7 +27,7 @@ const showAppToAuthorize = async (request, h) => {
const hcard = await hcardService(client_id)
// parse space-separated scope into array to make it edible for handlebarsjs.
const { scope = '' } = request.query
const scopeAsList = scope.split(' ').map(scope => ({ scope }))
const scopeAsList = scope ? scope.split(' ').map(scope => ({ scope })) : []
return h.view('authorize', { ...request.query, hcard, scopeAsList })
}