File tree Expand file tree Collapse file tree
src/components/FileManager Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,15 +18,19 @@ export function isValidName(name: string) {
1818 return true ;
1919}
2020
21- export async function getFolderZip ( path : string ) {
21+ export async function getFolderZip ( folderPath : string ) {
2222 const zip = new JSZip ( ) ;
23- const files = await readdir ( path , { withFileTypes : true , recursive : true } ) ;
23+ const files = await readdir ( folderPath , {
24+ withFileTypes : true ,
25+ recursive : true ,
26+ } ) ;
2427 for ( const file of files ) {
2528 const path = resolve ( file . parentPath , file . name ) ;
2629 if ( file . isDirectory ( ) ) {
2730 zip . folder ( path ) ;
2831 } else if ( file . isFile ( ) ) {
29- const content = await readFile ( path ) ;
32+ const absolutePath = resolve ( folderPath , file . parentPath , file . name ) ;
33+ const content = await readFile ( absolutePath ) ;
3034 zip . file ( path , content ) ;
3135 }
3236 }
You can’t perform that action at this time.
0 commit comments