@@ -206,8 +206,15 @@ func createLogEntry(params entries.CreateLogEntryParams) (models.LogEntry, middl
206
206
case int32 (code .Code_OK ):
207
207
case int32 (code .Code_ALREADY_EXISTS ), int32 (code .Code_FAILED_PRECONDITION ):
208
208
existingUUID := hex .EncodeToString (rfc6962 .DefaultHasher .HashLeaf (leaf ))
209
- err := fmt .Errorf ("grpc error: %v" , insertionStatus .String ())
210
- return nil , handleRekorAPIError (params , http .StatusConflict , err , fmt .Sprintf (entryAlreadyExists , existingUUID ), "entryURL" , getEntryURL (* params .HTTPRequest .URL , existingUUID ))
209
+ activeTree := fmt .Sprintf ("%x" , api .logID )
210
+ entryIDstruct , err := sharding .CreateEntryIDFromParts (activeTree , existingUUID )
211
+ if err != nil {
212
+ err := fmt .Errorf ("error creating EntryID from active treeID %v and uuid %v: %w" , activeTree , existingUUID , err )
213
+ return nil , handleRekorAPIError (params , http .StatusInternalServerError , err , fmt .Sprintf (validationError , err ))
214
+ }
215
+ existingEntryID := entryIDstruct .ReturnEntryIDString ()
216
+ err = fmt .Errorf ("grpc error: %v" , insertionStatus .String ())
217
+ return nil , handleRekorAPIError (params , http .StatusConflict , err , fmt .Sprintf (entryAlreadyExists , existingEntryID ), "entryURL" , getEntryURL (* params .HTTPRequest .URL , existingEntryID ))
211
218
default :
212
219
err := fmt .Errorf ("grpc error: %v" , insertionStatus .String ())
213
220
return nil , handleRekorAPIError (params , http .StatusInternalServerError , err , trillianUnexpectedResult )
0 commit comments