From 5e978301ba35edf93754e1122320e3632b34c4dd Mon Sep 17 00:00:00 2001 From: Mo Mesgin Date: Tue, 29 Oct 2024 16:54:57 -0700 Subject: [PATCH] add oci url to the list of acceptable urls --- shell/utils/validators/formRules/__tests__/index.test.ts | 1 + shell/utils/validators/formRules/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/utils/validators/formRules/__tests__/index.test.ts b/shell/utils/validators/formRules/__tests__/index.test.ts index 54e5f95e4e8..4123f54e94d 100644 --- a/shell/utils/validators/formRules/__tests__/index.test.ts +++ b/shell/utils/validators/formRules/__tests__/index.test.ts @@ -1117,6 +1117,7 @@ describe('formRules', () => { const testCases = [ ['', undefined], ['https://github.com/rancher/fleet-examples.git', undefined], + ['oci://test.rancher.io/charts/mychart', undefined], ['git@github.com:rancher/fleet-examples.git', undefined], ['http://100.100.100.127', undefined], ['aaaAAAA111//', message], diff --git a/shell/utils/validators/formRules/index.ts b/shell/utils/validators/formRules/index.ts index fd1c84182e2..a5a2d5cd4ed 100644 --- a/shell/utils/validators/formRules/index.ts +++ b/shell/utils/validators/formRules/index.ts @@ -458,7 +458,7 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): { return runValidators(val, [startHyphen('label'), endHyphen('label'), startDot('label'), endDot('label'), required]); }; - const repo: Validator = (val) => val && !/((git|ssh|http(s)?)|(git@[\w\.]+))(\:(\/\/)?)([\w\.@\:/\-~]+)(\.git)?(\/)?/.test(val) ? t('validation.setting.repo') : undefined; + const repo: Validator = (val) => val && !/((git|ssh|oci|http(s)?)|(git@[\w\.]+))(\:(\/\/)?)([\w\.@\:/\-~]+)(\.git)?(\/)?/.test(val) ? t('validation.setting.repo') : undefined; return { absolutePath,