From 74766c1c66a9cc52c43b1f8b8a2eda1ddacf0eed Mon Sep 17 00:00:00 2001 From: Stefan Kip <mail@kipusoep.nl> Date: Tue, 29 Mar 2022 09:48:45 +0200 Subject: [PATCH] fix: Referencing a preset on Azure DevOps with space in project name doesn't work (#14800) (#14826) --- lib/config/presets/index.spec.ts | 11 +++++++++++ lib/config/presets/index.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/config/presets/index.spec.ts b/lib/config/presets/index.spec.ts index fa6e3f42db..e560f956d5 100644 --- a/lib/config/presets/index.spec.ts +++ b/lib/config/presets/index.spec.ts @@ -446,6 +446,17 @@ describe('config/presets/index', () => { presetSource: 'local', }); }); + it('parses local with spaces and subdirectory', () => { + expect( + presets.parsePreset('local>A2B CD/A2B_Renovate//some-dir/some-file') + ).toEqual({ + repo: 'A2B CD/A2B_Renovate', + params: undefined, + presetName: 'some-file', + presetPath: 'some-dir', + presetSource: 'local', + }); + }); it('parses local with sub preset and tag', () => { expect( presets.parsePreset( diff --git a/lib/config/presets/index.ts b/lib/config/presets/index.ts index f926a19957..04d1b0e845 100644 --- a/lib/config/presets/index.ts +++ b/lib/config/presets/index.ts @@ -38,7 +38,7 @@ const presetSources: Record<string, PresetApi> = { }; const nonScopedPresetWithSubdirRegex = regEx( - /^(?<repo>~?[\w\-./]+?)\/\/(?:(?<presetPath>[\w\-./]+)\/)?(?<presetName>[\w\-.]+)(?:#(?<tag>[\w\-./]+?))?$/ + /^(?<repo>~?[\w\-. /]+?)\/\/(?:(?<presetPath>[\w\-./]+)\/)?(?<presetName>[\w\-.]+)(?:#(?<tag>[\w\-./]+?))?$/ ); const gitPresetRegex = regEx( /^(?<repo>~?[\w\-. /]+)(?::(?<presetName>[\w\-.+/]+))?(?:#(?<tag>[\w\-./]+?))?$/ -- GitLab