From 656397727017ad93290bd781c7dffb1874fbae51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Thu, 31 Oct 2019 07:55:43 -0700 Subject: [PATCH] fix(file): replaced backslash in path output of generate images API res Image save path in generateImages API result includes backslash on Windows. We need to replace backslashes with slashes for the path output. fix #64 --- src/helpers/file.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/helpers/file.ts b/src/helpers/file.ts index 871e2a85..46f4d93c 100644 --- a/src/helpers/file.ts +++ b/src/helpers/file.ts @@ -31,6 +31,10 @@ const isHtmlFile = (file: string): boolean => { return ['html', 'htm'].includes(getExtension(file)); }; +const convertBackslashPathToSlashPath = (backSlashPath: string): string => { + return slash(backSlashPath); +}; + const getAppDir = (): string => { let appPath; try { @@ -50,7 +54,9 @@ const getImageSavePath = ( outputFolder: string, ext: Extension, ): string => { - return path.join(outputFolder, `${imageName}.${ext}`); + return convertBackslashPathToSlashPath( + path.join(outputFolder, `${imageName}.${ext}`), + ); }; const fileUrl = (filePath: string): string => { @@ -142,10 +148,6 @@ const writeFile = (filePath: string, data: string): Promise => { }); }; -const convertBackslashPathToSlashPath = (backSlashPath: string): string => { - return slash(backSlashPath); -}; - const getRelativeImagePath = ( outputFilePath: string, imagePath: string,