From f127c3a4a3e23e67bb23fda452826945d0ed9689 Mon Sep 17 00:00:00 2001 From: Christian Capeans Date: Mon, 3 Jul 2023 16:11:19 +0200 Subject: [PATCH] Specify the right path --- .../src/strapi/providers/local-destination/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core/data-transfer/src/strapi/providers/local-destination/index.ts b/packages/core/data-transfer/src/strapi/providers/local-destination/index.ts index 69d82404c7..67b4d3a3d2 100644 --- a/packages/core/data-transfer/src/strapi/providers/local-destination/index.ts +++ b/packages/core/data-transfer/src/strapi/providers/local-destination/index.ts @@ -217,7 +217,12 @@ class LocalStrapiDestinationProvider implements IDestinationProvider { async #removeAssetsBackup() { if (strapi.config.get('plugin.upload').provider === 'local') { - await fse.rm(this.uploadsBackupDirectoryName, { recursive: true, force: true }); + assertValidStrapi(this.strapi); + const backupDirectory = path.join( + this.strapi.dirs.static.public, + this.uploadsBackupDirectoryName + ); + await fse.rm(backupDirectory, { recursive: true, force: true }); } } @@ -225,7 +230,7 @@ class LocalStrapiDestinationProvider implements IDestinationProvider { async createAssetsWriteStream(): Promise { assertValidStrapi(this.strapi, 'Not able to stream Assets'); - const removeAssetsBackup = this.#removeAssetsBackup; + const removeAssetsBackup = this.#removeAssetsBackup.bind(this); const strapi = this.strapi; const transaction = this.transaction; return new Writable({