Skip to content

Commit

Permalink
Mitigate that some group avatar paths are relative #3257
Browse files Browse the repository at this point in the history
  • Loading branch information
LinaKind committed May 20, 2024
1 parent c92cf99 commit 71bb34b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/read-side/non-html-views/docmaps/docmap/render-docmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const createAction = (expressionDoi: EDOI.ExpressionDoi) => (evaluation: Evaluat
],
});

const constructLogoUrl = (avatarPath: string) => (
avatarPath.startsWith('http')
? avatarPath
: `https://sciety.org${avatarPath}`);

export const renderDocmap = (viewModel: DocmapViewModel): Docmap => ({
'@context': 'https://w3id.org/docmaps/context.jsonld',
id: `https://sciety.org/docmaps/v1/articles/${viewModel.expressionDoi}/${viewModel.group.slug}.docmap.json`,
Expand All @@ -55,7 +60,7 @@ export const renderDocmap = (viewModel: DocmapViewModel): Docmap => ({
publisher: {
id: viewModel.group.homepage,
name: viewModel.group.name,
logo: `https://sciety.org${viewModel.group.avatarPath}`,
logo: constructLogoUrl(viewModel.group.avatarPath),
homepage: viewModel.group.homepage,
account: {
id: publisherAccountId(viewModel.group),
Expand Down

0 comments on commit 71bb34b

Please sign in to comment.