diff --git a/src/authStrategies/RemoteAuth.js b/src/authStrategies/RemoteAuth.js index 99e688ba2f..7d06f15586 100644 --- a/src/authStrategies/RemoteAuth.js +++ b/src/authStrategies/RemoteAuth.js @@ -103,8 +103,8 @@ class RemoteAuth extends BaseAuthStrategy { const pathExists = await this.isValidPath(this.userDataDir); if (pathExists) { await this.compressSession(); - await this.store.save({session: this.sessionName}); - await fs.promises.unlink(`${this.sessionName}.zip`); + await this.store.save({session: path.join(this.dataPath, this.sessionName)}); + await fs.promises.unlink(path.join(this.dataPath, `${this.sessionName}.zip`)); await fs.promises.rm(`${this.tempDir}`, { recursive: true, force: true @@ -115,7 +115,7 @@ class RemoteAuth extends BaseAuthStrategy { async extractRemoteSession() { const pathExists = await this.isValidPath(this.userDataDir); - const compressedSessionPath = `${this.sessionName}.zip`; + const compressedSessionPath = path.join(this.dataPath, `${this.sessionName}.zip`); const sessionExists = await this.store.sessionExists({session: this.sessionName}); if (pathExists) { await fs.promises.rm(this.userDataDir, { @@ -138,7 +138,7 @@ class RemoteAuth extends BaseAuthStrategy { async compressSession() { const archive = archiver('zip'); - const stream = fs.createWriteStream(`${this.sessionName}.zip`); + const stream = fs.createWriteStream(path.join(this.dataPath, `${this.sessionName}.zip`)); await fs.copy(this.userDataDir, this.tempDir).catch(() => {}); await this.deleteMetadata();