From b339a98dfadeaef7abf1181c25ce0615cbec87f5 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 5 Dec 2018 05:39:24 +0100 Subject: [PATCH] =?UTF-8?q?fix(config):=20handle=20complicated=20=E2=80=9C?= =?UTF-8?q?and=E2=80=9D=20massaging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2880 --- lib/config/migration.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/config/migration.js b/lib/config/migration.js index b7592e27c9..4d14bac104 100644 --- a/lib/config/migration.js +++ b/lib/config/migration.js @@ -235,7 +235,8 @@ function migrateConfig(config) { // massage to array first const schedules = is.string(val) ? [val] : val; // split 'and' - for (let i = 0; i < schedules.length; i += 1) { + const schedulesLength = schedules.length; + for (let i = 0; i < schedulesLength; i += 1) { if ( schedules[i].includes(' and ') && schedules[i].includes('before ') && @@ -256,15 +257,15 @@ function migrateConfig(config) { const toSplit = schedules[i]; schedules[i] = toSplit .replace( - /^(after|before) (.*?) and (after|before) (.*?)( |$)(.*)/, - '$1 $2 $6' + /^(.*?)(after|before) (.*?) and (after|before) (.*?)( |$)(.*)/, + '$1$2 $3 $7' ) .trim(); schedules.push( toSplit .replace( - /^(after|before) (.*?) and (after|before) (.*?)( |$)(.*)/, - '$3 $4 $6' + /^(.*?)(after|before) (.*?) and (after|before) (.*?)( |$)(.*)/, + '$1$4 $5 $7' ) .trim() ); -- GitLab