From 4449b3847000bebc71ea9af9b3b44c02abd02971 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 2 Oct 2024 08:42:21 +0530 Subject: [PATCH] Add some comments on the newly added code --- recipe/dashboard/api/implementation.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipe/dashboard/api/implementation.go b/recipe/dashboard/api/implementation.go index f2a5f295..b6c0ea1e 100644 --- a/recipe/dashboard/api/implementation.go +++ b/recipe/dashboard/api/implementation.go @@ -47,11 +47,18 @@ func MakeAPIImplementation() dashboardmodels.APIInterface { return "", err } + // We are splitting the passed URI here so that if multiple URI's are passed + // separated by a colon, the first one is returned. connectionURIToNormalize := strings.Split(stInstance.SuperTokens.ConnectionURI, ";")[0] + // This normalizes the URI to make sure that it has things like protocol etc + // injected into it before it is returned. var normalizationError error normalizedConnectionURI, normalizationError := supertokens.NewNormalisedURLDomain(connectionURIToNormalize) if normalizationError != nil { + // In case of failures, we want to return a 500 here, mainly because that + // is what we return if the connectionURI is invalid which is the case here + // if normalization fails. return "", normalizationError } connectionURI := normalizedConnectionURI.GetAsStringDangerous()