From a43f4bf155b9e113dd6ddc9f1f023bdef17a27bb Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Wed, 1 Jan 2025 16:41:47 +0200 Subject: [PATCH] reuse the random identifier --- apis/record_crud.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apis/record_crud.go b/apis/record_crud.go index 06d0ce1b..a5a6c33e 100644 --- a/apis/record_crud.go +++ b/apis/record_crud.go @@ -266,10 +266,12 @@ func recordCreate(optFinalizer func(data any) error) func(e *core.RequestEvent) if !hasSuperuserAuth && e.Collection.CreateRule != nil { dummyRecord := e.Record.Clone() + dummyRandomPart := "__pb_create__" + security.PseudorandomString(6) + // set an id if it doesn't have already // (the value doesn't matter; it is used only to minimize the breaking changes with earlier versions) if dummyRecord.Id == "" { - dummyRecord.Id = "__pb_create__temp_id_" + security.PseudorandomString(5) + dummyRecord.Id = "__temp_id__" + dummyRandomPart } // unset the verified field to prevent manage API rule misuse in case the rule relies on it @@ -292,7 +294,6 @@ func recordCreate(optFinalizer func(data any) error) func(e *core.RequestEvent) } // shallow clone the current collection - dummyRandomPart := "__pb_create__" + security.PseudorandomString(5) dummyCollection := *e.Collection dummyCollection.Id += dummyRandomPart dummyCollection.Name += inflector.Columnify(dummyRandomPart)