@@ -648,64 +648,3 @@ export const findAttachments = (
648648
649649 return uniqueResult ?? [ ] ;
650650} ;
651-
652- export const getAttachmentsDirectoryOld = (
653- baseDirectory : string ,
654- filePath : string = "" ,
655- attachmentPath : string = ""
656- ) : string => {
657- let result = baseDirectory ;
658-
659- if ( attachmentPath . length === 0 || filePath . length === 0 ) {
660- return "" ;
661- }
662-
663- //FIXME use DENO
664- const filePathList = filePath . split ( "/" ) ;
665- let attachmentPathList = attachmentPath . split ( "/" ) ;
666-
667- //TODO navigate path with '..'
668- if ( attachmentPathList . length === 2 && attachmentPathList [ 0 ] === "." ) {
669- attachmentPathList = attachmentPathList . slice ( 1 ) ;
670- }
671-
672- const pathNoFileFromList = ( pathList : string [ ] ) =>
673- pathList . slice ( 0 , pathList . length - 1 ) . join ( "/" ) ;
674-
675- if ( attachmentPathList . some ( ( path ) => path . endsWith ( "_files" ) ) ) {
676- return baseDirectory ;
677- }
678-
679- if ( result . endsWith ( "/_site" ) ) {
680- result = result . slice ( 0 , - 6 ) ;
681- }
682-
683- const isRelative = attachmentPathList . length === 1 ;
684-
685- if ( isRelative && filePathList . length > 1 ) {
686- const directoryPath = pathNoFileFromList ( filePathList ) ;
687- result = `${ result } /${ directoryPath } ` ;
688- }
689-
690- return result ;
691- } ;
692-
693- export const getAttachmentsDirectory = (
694- baseDirectory : string ,
695- filePath : string = "" ,
696- attachmentPath : string = ""
697- ) : string => {
698- let result = baseDirectory ;
699-
700- const baseParse = parse ( baseDirectory ) ;
701- const baseDirectoryBaseName = basename ( baseDirectory ) ;
702-
703- if ( attachmentPath . length === 0 || filePath . length === 0 ) {
704- return "" ;
705- }
706-
707- if ( baseDirectoryBaseName === "_site" ) {
708- }
709-
710- return result ;
711- } ;
0 commit comments