From f0ebd30f5ce48730da50b2caa41663467581934d Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Mon, 1 Apr 2024 18:28:27 +0200 Subject: [PATCH] fix(client): show source code link when localhost exists (#54087) --- client/src/utils/solution-display-type.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/utils/solution-display-type.ts b/client/src/utils/solution-display-type.ts index b28c7b9780e..c15c123e56c 100644 --- a/client/src/utils/solution-display-type.ts +++ b/client/src/utils/solution-display-type.ts @@ -1,6 +1,6 @@ import type { CompletedChallenge } from '../redux/prop-types'; import { challengeTypes } from '../../../shared/config/challenge-types'; -import { maybeUrlRE } from '.'; +import { hasProtocolRE } from '.'; type DisplayType = | 'none' @@ -26,7 +26,7 @@ export const getSolutionDisplayType = ({ if (!solution) return 'none'; // Some of the user records still have JavaScript project solutions stored as // solution strings - if (!maybeUrlRE.test(solution)) return 'showUserCode'; - if (maybeUrlRE.test(githubLink ?? '')) return 'showProjectAndGithubLinks'; + if (!hasProtocolRE.test(solution)) return 'showUserCode'; + if (hasProtocolRE.test(githubLink ?? '')) return 'showProjectAndGithubLinks'; return 'showProjectLink'; };