File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 1- import path from 'path'
2- import fs from 'fs'
31import {
42 DeleteObjectsCommand ,
53 GetObjectCommand ,
4+ ListObjectsCommand ,
65 ListObjectsV2Command ,
76 PutObjectCommand ,
8- ListObjectsCommand ,
97 S3Client ,
108 S3ClientConfig
119} from '@aws-sdk/client-s3'
1210import { Storage } from '@google-cloud/storage'
11+ import fs from 'fs'
1312import { Readable } from 'node:stream'
14- import { getUserHome } from './utils'
15- import { isValidUUID , isPathTraversal } from './validator'
13+ import path from 'path'
1614import sanitize from 'sanitize-filename'
15+ import { getUserHome } from './utils'
16+ import { isPathTraversal , isValidUUID } from './validator'
1717
1818const dirSize = async ( directoryPath : string ) => {
1919 let totalSize = 0
@@ -531,7 +531,13 @@ function getFilePaths(dir: string): FileInfo[] {
531531 * Prepare storage path
532532 */
533533export const getStoragePath = ( ) : string => {
534- return process . env . BLOB_STORAGE_PATH ? path . join ( process . env . BLOB_STORAGE_PATH ) : path . join ( getUserHome ( ) , '.flowise' , 'storage' )
534+ const storagePath = process . env . BLOB_STORAGE_PATH
535+ ? path . join ( process . env . BLOB_STORAGE_PATH )
536+ : path . join ( getUserHome ( ) , '.flowise' , 'storage' )
537+ if ( ! fs . existsSync ( storagePath ) ) {
538+ fs . mkdirSync ( storagePath , { recursive : true } )
539+ }
540+ return storagePath
535541}
536542
537543/**
You can’t perform that action at this time.
0 commit comments