From 20ff2b021267b5481ceaa0ea430b2fd84535e357 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Thu, 13 Oct 2022 20:21:59 +0100 Subject: [PATCH] fix: arc no longer crashes due to _id clobbering --- .../score-import/import-types/api/arc-iidx/converter.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts b/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts index 730f476fa..c3d472763 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts @@ -48,6 +48,13 @@ export const ConvertAPIArcIIDX: ConverterFunction = async throw new InvalidScoreFailure(FormatPrError(err, "Invalid ARC Score: ")); } + // @ts-expect-error ARC sends over _id tags in their data, which may be saved into + // mongoDB. + // Our monk driver recursively tries to convert `_id` keys into being ObjectIDs + // which may not be possible. As such, it will throw an error if _id exists anywhere + // in an object. + delete data._id; + // confirmed by Prudence above. const score = data as ARCIIDXScore;