From 9779c46893237daa01b18ff8a0b7cd7c67ad8eae Mon Sep 17 00:00:00 2001 From: Maurice Le Choco Swiss Date: Mon, 5 Aug 2024 19:38:42 +0200 Subject: [PATCH] fix: update regex to allow whitespace & `+` in Windows path (#74) Co-authored-by: Dominik G. Co-authored-by: Haoqun Jiang --- packages/launch-editor/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/launch-editor/index.js b/packages/launch-editor/index.js index 76bb787..55e7316 100644 --- a/packages/launch-editor/index.js +++ b/packages/launch-editor/index.js @@ -106,8 +106,8 @@ function launchEditor (file, specifiedEditor, onErrorCallback) { // and // https://github.com/facebook/create-react-app/pull/5431) - // Allows alphanumeric characters, periods, dashes, slashes, and underscores. - const WINDOWS_CMD_SAFE_FILE_NAME_PATTERN = /^([A-Za-z]:[/\\])?[\p{L}0-9/.\-_\\]+$/u + // Allows alphanumeric characters, periods, dashes, slashes, underscores, plus and space. + const WINDOWS_CMD_SAFE_FILE_NAME_PATTERN = /^([A-Za-z]:[/\\])?[\p{L}0-9/.\-\\_+ ]+$/u if ( process.platform === 'win32' && !WINDOWS_CMD_SAFE_FILE_NAME_PATTERN.test(fileName.trim())