matrix-art

An image gallery for Matrix
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art.git
Log | Files | Refs | README | LICENSE

commit 13e0776c2ddff32d8f973a56197664d282306dc2
parent abc4189a0983b546432ac5bb6184ce922e2a871b
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue,  1 Mar 2022 00:07:50 +0100

Debug the tokens not getting deleted

Diffstat:
Mhelpers/storage.ts | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/helpers/storage.ts b/helpers/storage.ts @@ -103,9 +103,14 @@ export default class Storage { const fs = await import('fs'); const path = await import('path'); try { - const stat = await fs.promises.stat(path.join(this.localFolder!, this.prefix, key)); + const file_path = path.join(this.localFolder!, this.prefix, key); + const stat = await fs.promises.stat(file_path); + console.log("file_path:", file_path); + console.log("stat:", stat.isFile()); if (stat.isFile()) { - await fs.promises.unlink(path.join(this.localFolder!, this.prefix, key)); + console.log("unlink"); + await fs.promises.unlink(file_path); + console.log("unlinked"); } } catch { } } catch { @@ -114,7 +119,7 @@ export default class Storage { } } - async setOrDelete(key: string, value: string | undefined): Promise<void> { + async setOrDelete(key: string, value?: string): Promise<void> { if (value) { await this.setItem(key, value); } else {