From f377a8fbcdeb59e996ea2856fbfc24dabe51f583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mime=20=C4=8Cuvalo?= Date: Fri, 24 Nov 2023 19:45:12 +0000 Subject: [PATCH] fix NPE in lightbox --- data/graphql-generated.ts | 4 ++-- data/resolvers/content.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/graphql-generated.ts b/data/graphql-generated.ts index 9f3eddb..ad03f15 100644 --- a/data/graphql-generated.ts +++ b/data/graphql-generated.ts @@ -500,7 +500,7 @@ export type ContentAndUserQueryVariables = Exact<{ }>; -export type ContentAndUserQuery = { __typename?: 'Query', fetchContent?: { __typename?: 'Content', album: string, code: string, commentsCount: number, commentsUpdated?: any | null, content: string, count: number, countRobot: number, createdAt: any, forceRefresh?: boolean | null, hidden: boolean, name: string, section: string, style: string, template: string, thread?: string | null, thumb: string, title: string, updatedAt: any, username: string, view: string } | null, fetchCommentsRemote: Array<{ __typename?: 'Comment', avatar?: string | null, creator?: string | null, content?: string | null, deleted: boolean, favorited: boolean, fromUsername?: string | null, link: string, localContentName?: string | null, postId: string, type: string, username: string, view: string }>, fetchFavoritesRemote: Array<{ __typename?: 'Favorite', avatar?: string | null, fromUsername?: string | null, localContentName?: string | null, postId: string, type: string, username: string }>, fetchPublicUserData?: { __typename?: 'UserPublic', username: string, description?: string | null, favicon?: string | null, logo?: string | null, name: string, sidebarHtml?: string | null, title: string, theme: string, viewport?: string | null, license?: string | null } | null, fetchSiteMap: Array<{ __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string }>, fetchContentNeighbors?: { __typename?: 'Neighbors', first?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string } | null, last?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string } | null, next?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string, prefetchImages?: Array | null } | null, prev?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string, prefetchImages?: Array | null } | null, top?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string, template: string } | null } | null }; +export type ContentAndUserQuery = { __typename?: 'Query', fetchContent?: { __typename?: 'Content', album: string, code: string, commentsCount: number, commentsUpdated?: any | null, content: string, count: number, countRobot: number, createdAt: any, forceRefresh?: boolean | null, hidden: boolean, name: string, section: string, style: string, template: string, thread?: string | null, thumb: string, title: string, updatedAt: any, username: string, view: string } | null, fetchCommentsRemote: Array<{ __typename?: 'Comment', avatar?: string | null, creator?: string | null, content?: string | null, deleted: boolean, favorited: boolean, fromUsername?: string | null, link: string, localContentName?: string | null, postId: string, type: string, username: string, view: string }>, fetchFavoritesRemote: Array<{ __typename?: 'Favorite', avatar?: string | null, fromUsername?: string | null, localContentName?: string | null, postId: string, type: string, username: string }>, fetchPublicUserData?: { __typename?: 'UserPublic', username: string, description?: string | null, favicon?: string | null, logo?: string | null, name: string, sidebarHtml?: string | null, title: string, theme: string, viewport?: string | null, license?: string | null, googleAnalytics?: string | null } | null, fetchSiteMap: Array<{ __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string }>, fetchContentNeighbors?: { __typename?: 'Neighbors', first?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string } | null, last?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string } | null, next?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string, prefetchImages?: Array | null } | null, prev?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string, prefetchImages?: Array | null } | null, top?: { __typename?: 'ContentMetaInfo', album: string, forceRefresh: boolean, hidden: boolean, name: string, section: string, title: string, username: string, template: string } | null } | null }; export type FetchCollectionQueryVariables = Exact<{ username: Scalars['String']['input']; @@ -527,7 +527,7 @@ export type FetchAlbumCollectionQueryVariables = Exact<{ }>; -export type FetchAlbumCollectionQuery = { __typename?: 'Query', fetchCollection: Array<{ __typename?: 'ContentMetaInfo', album: string, externalLink?: string | null, forceRefresh: boolean, hidden: boolean, name: string, section: string, thumb: string, title: string, username: string }> }; +export type FetchAlbumCollectionQuery = { __typename?: 'Query', fetchCollection: Array<{ __typename?: 'ContentMetaInfo', album: string, externalLink?: string | null, forceRefresh: boolean, hidden: boolean, name: string, section: string, thumb: string, title: string, username: string, prefetchImages?: Array | null }> }; export type FetchArchiveCollectionQueryVariables = Exact<{ username: Scalars['String']['input']; diff --git a/data/resolvers/content.ts b/data/resolvers/content.ts index f37c28c..7807ca1 100644 --- a/data/resolvers/content.ts +++ b/data/resolvers/content.ts @@ -573,9 +573,9 @@ function decorateArrayWithPrefetchImages(list: ContentType[]) { function decoratePrefetchImages(item: ContentType) { if (item) { - item.prefetchImages = (item.view.match(/src=['"][^'"]+['"]/g) || []) + item.prefetchImages = (item.view?.match(/src=['"][^'"]+['"]/g) || []) .map((i) => i.slice(5, -1)) - .concat((item.content.match(/https[^)]*/g) || []).map((i) => i.slice(5, -1))); + .concat(item.content?.match(/https[^)]*/g) || []); } return item;