Fix workspace folder deletion error (#13270)

context : workspace folder deletion throws error when folder does not
exist (in case, workspace users have not upload any files (profil pic,
workflows, attachments, ...))
-> sentry errors :
https://twenty-v7.sentry.io/issues/6565008010/?referrer=github_integration

solution : check folder existence before deleting

test local and s3 storage : 
- create a workspace and delete workspace
- create a workspace, add an attachment and delete workspace

closes : https://github.com/twentyhq/twenty/issues/10745
closes : https://github.com/twentyhq/twenty/issues/12299
This commit is contained in:
Etienne
2025-07-17 23:01:02 +02:00
committed by GitHub
parent abd9f8205b
commit 21fb68b9e2
5 changed files with 40 additions and 0 deletions
@@ -93,6 +93,13 @@ export class FileService {
async deleteWorkspaceFolder(workspaceId: string) {
const workspaceFolderPath = `workspace-${workspaceId}`;
const isWorkspaceFolderFound =
await this.fileStorageService.checkFolderExists(workspaceFolderPath);
if (!isWorkspaceFolderFound) {
return;
}
return await this.fileStorageService.delete({
folderPath: workspaceFolderPath,
});