Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path with ( causes "SyntaxError: Invalid regular expression" #3475

Open
h-brockmann opened this issue Jan 24, 2024 · 1 comment
Open

Path with ( causes "SyntaxError: Invalid regular expression" #3475

h-brockmann opened this issue Jan 24, 2024 · 1 comment

Comments

@h-brockmann
Copy link

h-brockmann commented Jan 24, 2024

Due to naming conventions and limitations of windows, my username has an opening bracket in it.
This bracket causes a SyntaxError since the path to %APPDATA% gets evaluated as regular Expression

2024-01-24 13:43:01.810 [error] Activating extension redhat.java failed due to an error:
2024-01-24 13:43:01.810 [error] SyntaxError: Invalid regular expression: /c:\Users\xxxxusernamexxxx(xxx\AppData\Roaming\Code\User\workspaceStorage\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\redhat.java\client.log.2024-01-24/: Unterminated group
	at String.match (<anonymous>)
	at c.getStream (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:294045)
	at new m (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:1453936)
	at t.initializeLogFile (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:953503)
	at c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:915356
	at Generator.next (<anonymous>)
	at o (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:907644)
Environment
  • Operating System: Windows 11
  • JDK version: openjdk version "11.0.0.1"
  • Visual Studio Code version: 1.85.2
  • Java extension version: v1.26.0
Steps To Reproduce
  1. Set up a user in windows with a name like xxx(yyy
  2. Install vscode
  3. Install Extension
  4. Start vscode + extension
Current Result

SyntaxError

Expected Result

No SyntaxError.
Escaping symbols in path.

Additional Informations

n/a

@rgrunber
Copy link
Member

rgrunber commented Jan 24, 2024

Looks like this is happening at

export function initializeLogFile(filename: string) {
logger.add(new DailyRotateFile({

winstonjs/winston-daily-rotate-file#355 . There's already a fix in the affected library but it seems like winston-daily-rotate-file hasn't adopted the change.

@testforstephen , it doesn't look like that issue will be getting fixed. Maybe we could catch the exception and continue without logging. Would be better than outright failure to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants