File tree Expand file tree Collapse file tree
packages/server/src/api/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 UpdateProjectRequest ,
1414 UpdateProjectResponse ,
1515} from "@budibase/types"
16+ import fsp from "fs/promises"
1617import sdk from "../../sdk"
1718
1819export const toProjectResponse = ( project : Project ) : ProjectResponse => {
@@ -123,12 +124,18 @@ export async function importBundle(
123124 ctx . throw ( 400 , "Must supply Project export file to import" )
124125 }
125126
126- ctx . body = await sdk . projects . importProject (
127- {
128- path : filePath ,
129- } ,
130- {
131- encryptPassword : ctx . request . body ?. encryptPassword || undefined ,
132- }
133- )
127+ try {
128+ ctx . body = await sdk . projects . importProject (
129+ {
130+ path : filePath ,
131+ } ,
132+ {
133+ encryptPassword : ctx . request . body ?. encryptPassword || undefined ,
134+ }
135+ )
136+ } finally {
137+ await fsp . rm ( filePath , { force : true } ) . catch ( error => {
138+ console . log ( "Failed to remove uploaded Project import archive" , error )
139+ } )
140+ }
134141}
You can’t perform that action at this time.
0 commit comments