Skip to content

Commit

Permalink
fix(nx-dev): Og image path generation (#27458)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9d99d5f)
  • Loading branch information
ndcunningham authored Aug 15, 2024
1 parent 706a13f commit c6cf097
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nx-dev/data-access-documents/src/lib/blog.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export class BlogApi {
if (!imagePath) {
return { image: defaultImage, type: defaultType };
}

const { ext } = parse(imagePath);

if (!allowedExtensions.includes(ext)) {
Expand All @@ -190,10 +191,14 @@ export class BlogApi {
}

return {
image: imagePath.replace(ext, foundExt),
image: join('documentation', imagePath.replace(ext, foundExt)),
type: foundExt.replace('.', ''),
};
}
return { image: imagePath, type: ext.replace('.', '') };

return {
image: join('documentation', imagePath),
type: ext.replace('.', ''),
};
}
}

0 comments on commit c6cf097

Please sign in to comment.