@@ -420,8 +420,10 @@ export class EmojiProcessor {
420420 const cachedPath = validatePath ( this . config . emojiPath , cached . filename ) ;
421421 // eslint-disable-next-line security/detect-non-literal-fs-filename -- Path validated by validatePath()
422422 if ( fs . existsSync ( cachedPath ) ) {
423+ const baseUrl = process . env . BASE_URL || "/" ;
424+ const basePath = baseUrl . endsWith ( "/" ) ? baseUrl . slice ( 0 , - 1 ) : baseUrl ;
423425 return {
424- newPath : `/images/emojis/${ cached . filename } ` ,
426+ newPath : `${ basePath } /images/emojis/${ cached . filename } ` ,
425427 savedBytes : 0 ,
426428 reused : true ,
427429 } ;
@@ -497,8 +499,10 @@ export class EmojiProcessor {
497499 `Emoji reused (content match): ${ existingEntry [ 1 ] . filename } `
498500 )
499501 ) ;
502+ const baseUrl = process . env . BASE_URL || "/" ;
503+ const basePath = baseUrl . endsWith ( "/" ) ? baseUrl . slice ( 0 , - 1 ) : baseUrl ;
500504 return {
501- newPath : `/images/emojis/${ existingEntry [ 1 ] . filename } ` ,
505+ newPath : `${ basePath } /images/emojis/${ existingEntry [ 1 ] . filename } ` ,
502506 savedBytes : 0 ,
503507 reused : true ,
504508 } ;
@@ -555,8 +559,10 @@ export class EmojiProcessor {
555559 : chalk . green ( `Emoji processed and saved: ${ filename } ` )
556560 ) ;
557561
562+ const baseUrl = process . env . BASE_URL || "/" ;
563+ const basePath = baseUrl . endsWith ( "/" ) ? baseUrl . slice ( 0 , - 1 ) : baseUrl ;
558564 return {
559- newPath : `/images/emojis/${ filename } ` ,
565+ newPath : `${ basePath } /images/emojis/${ filename } ` ,
560566 savedBytes,
561567 reused : false ,
562568 } ;
0 commit comments