From 7bef537b8b651c06130d6fd188ad1012e2799ab1 Mon Sep 17 00:00:00 2001 From: ingalls Date: Tue, 5 Mar 2024 15:15:07 -0700 Subject: [PATCH 01/13] Improved Profile Delete --- api/lib/aws/s3.ts | 4 +- api/routes/profile-asset.ts | 8 ++++ .../src/components/CloudTAK/Menu/Datas.vue | 38 ++++++++++++++----- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/api/lib/aws/s3.ts b/api/lib/aws/s3.ts index 0f1eb4fec..8d95f9104 100644 --- a/api/lib/aws/s3.ts +++ b/api/lib/aws/s3.ts @@ -75,9 +75,7 @@ export default class S3 { })); return true; } catch (err) { - //@ts-ignore - if (err.code === 'NotFound') return false; - + if (String(err).startsWith('NotFound')) return false; throw new Err(500, new Error(err instanceof Error ? err.message : String(err)), 'Failed to determine existance'); } } diff --git a/api/routes/profile-asset.ts b/api/routes/profile-asset.ts index 9ebffd4de..5d5a18924 100644 --- a/api/routes/profile-asset.ts +++ b/api/routes/profile-asset.ts @@ -128,6 +128,14 @@ export default async function router(schema: Schema, config: Config) { await S3.del(`profile/${user.email}/${req.params.asset}.${req.params.ext}`); + if (await S3.exists(`profile/${user.email}/${req.params.asset}.geojsonld`)) { + await S3.del(`profile/${user.email}/${req.params.asset}.geojsonld`); + } + + if (await S3.exists(`profile/${user.email}/${req.params.asset}.pmtiles`)) { + await S3.del(`profile/${user.email}/${req.params.asset}.pmtiles`); + } + return res.json({ status: 200, message: 'Asset Deleted' diff --git a/api/web/src/components/CloudTAK/Menu/Datas.vue b/api/web/src/components/CloudTAK/Menu/Datas.vue index 96725a5a8..d572721f1 100644 --- a/api/web/src/components/CloudTAK/Menu/Datas.vue +++ b/api/web/src/components/CloudTAK/Menu/Datas.vue @@ -23,14 +23,24 @@