web/admin: fix blueprint instance list without metadata or labels (#5296)

* Update BlueprintListPage.ts

`Object.hasOwn()` throws an exception if the first argument is `null` or `undefined`.
This change ensures that the first argument is never `null` or `undefined`.

Signed-off-by: cskwrd <cskwrd@users.noreply.github.com>

* Update web/src/admin/blueprints/BlueprintListPage.ts

Signed-off-by: Jens L. <jens@beryju.org>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: cskwrd <cskwrd@users.noreply.github.com>
Signed-off-by: Jens L. <jens@beryju.org>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L <jens@beryju.org>
This commit is contained in:
cskwrd 2023-04-19 05:15:26 -05:00 committed by GitHub
parent 9ac6511548
commit 04cc7817ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -126,7 +126,11 @@ export class BlueprintListPage extends TablePage<BlueprintInstance> {
row(item: BlueprintInstance): TemplateResult[] {
let description = undefined;
const descKey = "blueprints.goauthentik.io/description";
if (Object.hasOwn(item.metadata?.labels, descKey)) {
if (
item.metadata &&
item.metadata.labels &&
Object.hasOwn(item.metadata?.labels, descKey)
) {
description = item.metadata?.labels[descKey];
}
return [