Skip to content

Commit 867c292

Browse files
committed
fix: consistently normalize entity UUIDs
1 parent 970ff08 commit 867c292

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/model/query/entities.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ const _processEntityData = (sourceId, entityData, event, form, submissionDef, fo
598598
// If it is a uuid collision, check if the entity was created via an update
599599
// in which case its ok to apply this create as an update
600600
if (err.problemCode === 409.3 && err.problemDetails?.fields[0] === 'uuid') {
601-
const rootDef = await Entities.getDef(dataset.id, entityData.system.id, new QueryOptions().withCondition({ root: true })).then(o => o.orNull());
601+
const rootDef = await Entities.getDef(dataset.id, normalizeUuid(entityData.system.id), new QueryOptions().withCondition({ root: true })).then(o => o.orNull());
602602
if (rootDef && rootDef.aux.source.forceProcessed) {
603603
maybeEntity = await Entities._updateEntity(sourceId, dataset, entityData, submissionDef, event, forceOutOfOrderProcessing, true);
604604
} else {
@@ -793,7 +793,8 @@ const assignCurrentVersionCreator = (entity) => {
793793
return new Entity(entity, { currentVersion, creator: entity.aux.creator });
794794
};
795795

796-
const getById = (datasetId, uuid, options = QueryOptions.none) => async ({ maybeOne }) => {
796+
const getById = (datasetId, wildtypeUuid, options = QueryOptions.none) => async ({ maybeOne }) => {
797+
const uuid = normalizeUuid(wildtypeUuid);
797798
if (options.forUpdate) {
798799
await _lockEntity(maybeOne, uuid);
799800
}

0 commit comments

Comments
 (0)