From c6cf097c1ede13b561d7f1bab88b5be2054ab1bc Mon Sep 17 00:00:00 2001 From: Nicholas Cunningham Date: Thu, 15 Aug 2024 10:36:32 -0600 Subject: [PATCH] fix(nx-dev): Og image path generation (#27458) (cherry picked from commit 9d99d5fcb736f39728b01688c2fd374d543eb91b) --- nx-dev/data-access-documents/src/lib/blog.api.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nx-dev/data-access-documents/src/lib/blog.api.ts b/nx-dev/data-access-documents/src/lib/blog.api.ts index 47c80794ddc8d..4dfd0469bec01 100644 --- a/nx-dev/data-access-documents/src/lib/blog.api.ts +++ b/nx-dev/data-access-documents/src/lib/blog.api.ts @@ -171,6 +171,7 @@ export class BlogApi { if (!imagePath) { return { image: defaultImage, type: defaultType }; } + const { ext } = parse(imagePath); if (!allowedExtensions.includes(ext)) { @@ -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('.', ''), + }; } }