From 8f827997cd01bfcd3449d83d138a335b71f43f5a Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 8 Nov 2021 13:55:30 -0800 Subject: [PATCH] Fix tags set via script saved in encoded form --- lib/db.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/db.ts b/lib/db.ts index b9be591..127ca02 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -446,14 +446,18 @@ export async function saveDevice( if (value2 != null) { if (!update["$addToSet"]["_tags"]) update["$addToSet"]["_tags"] = { $each: [] }; - update["$addToSet"]["_tags"]["$each"].push(path.segments[1]); + update["$addToSet"]["_tags"]["$each"].push( + decodeTag(path.segments[1] as string) + ); } else { if (!update["$pull"]["_tags"]) { update["$pull"]["_tags"] = { $in: [], }; } - update["$pull"]["_tags"]["$in"].push(path.segments[1]); + update["$pull"]["_tags"]["$in"].push( + decodeTag(path.segments[1] as string) + ); } }