From aebe35fc15a72919af97f5dd89c932f22337ce2b Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 30 Aug 2022 15:00:34 -0400 Subject: [PATCH] Don't unnecessarily extract uuid Signed-off-by: Priya Wadhwa --- pkg/api/entries.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/api/entries.go b/pkg/api/entries.go index cb1ce510e..c16220389 100644 --- a/pkg/api/entries.go +++ b/pkg/api/entries.go @@ -338,11 +338,11 @@ func SearchLogQueryHandler(params entries.SearchLogQueryParams) middleware.Respo resultPayload = append(resultPayload, logEntry) continue } - uuid, err := sharding.GetUUIDFromIDString(entryID) - if err != nil { - return handleRekorAPIError(params, http.StatusBadRequest, err, fmt.Sprintf("could not get UUID from ID string %v", entryID)) + // At this point, check if we got a uuid instead of an EntryID, so search for the hash later + uuid := entryID + if err := sharding.ValidateUUID(uuid); err != nil { + return handleRekorAPIError(params, http.StatusBadRequest, err, fmt.Sprintf("validating uuid %s", uuid)) } - // If we couldn't get the entry, search for the hash later hash, err := hex.DecodeString(uuid) if err != nil { return handleRekorAPIError(params, http.StatusBadRequest, err, malformedUUID)