From 5cdd17b7a8adb8567c7cabca79b11a54633980b0 Mon Sep 17 00:00:00 2001 From: Yuta Kaneda Date: Thu, 30 Nov 2023 16:17:46 +0900 Subject: [PATCH] fix(2952): Allow colon to be used in root directory --- config/regex.js | 2 +- test/config/regex.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/regex.js b/config/regex.js index 9054de85..57fef6d7 100644 --- a/config/regex.js +++ b/config/regex.js @@ -94,7 +94,7 @@ module.exports = { /^(?:(?:https:\/\/(?:[^@/:\s]+@)?)|git@|org-\d+@)+([^/:\s]+)(?:\/|:)([^/:\s]+)\/([^\s]+?)(?:\.git)(#[^: \s]* [^: \s]*|#[^: \s]+)?(:[^: \s]* [^: \s]*|:[^: \s]+)?$/, // scmUri. For example: github.com:abc-123:master or bitbucket.org:{123}:master // Optionally, can have rootDir. For example: github.com:abc-123:master:src/app/component - SCM_URI: /^([^:]+):([^:]+):([^:]+)(?::([^:]+))?$/, + SCM_URI: /^([^:]+):([^:]+):([^:]+)(?::(.*))?$/, // SCM context. For example: github:github.com, gitlab:gitlab.mycompany.com // First group: SCM plugin name (e.g. github) // Second group: SCM host name (e.g. github.com) diff --git a/test/config/regex.test.js b/test/config/regex.test.js index 90bfd622..ade0ec9e 100644 --- a/test/config/regex.test.js +++ b/test/config/regex.test.js @@ -452,12 +452,12 @@ describe('config regex', () => { it('checks good scmUri', () => { assert.isTrue(config.regex.SCM_URI.test('github.com:abc-123:master')); assert.isTrue(config.regex.SCM_URI.test('github.com:abc-123:master:src/app/component')); + assert.isTrue(config.regex.SCM_URI.test('github.com:abc-123:master:a:b:c')); assert.isTrue(config.regex.SCM_URI.test('bitbucket.org:d2lam/{123}:master')); }); it('fails on bad scmUri', () => { assert.isFalse(config.regex.SCM_URI.test('github.com:master')); - assert.isFalse(config.regex.SCM_URI.test('github.com:master:a:b:c')); assert.isFalse(config.regex.SCM_URI.test('bitbucket.org:{123}')); }); });