-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fix crash of extension when proxy settings address has wrong format #1046
Fix crash of extension when proxy settings address has wrong format #1046
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks pretty good so far.
I think, if we want to support something like 192.168.1.23:9090
as the proxy, we can use this regex:
(?:https?:\/\/)?([^:/]+)(?::([0-9]+))?
which just wraps the https://
part in a non-capturing group and makes it optional.
From what I can tell, we don't use the http:// or https:// part of the url anyways, so it shouldn't matter if it's left out.
I have tried the const HOST_AND_PORT_EXTRACTOR = (?:https?://)?([^:/]+)(?::([0-9]+))?; but it seems it is not a valid regexp |
ahh I think you need to surround it in const HOST_AND_PORT_EXTRACTOR = /(?:https?://)?([^:/]+)(?::([0-9]+))?/; |
diff --git a/src/settings/proxySettings.ts b/src/settings/proxySettings.ts
index 3cbcf38..6ee7d0c 100644
--- a/src/settings/proxySettings.ts
+++ b/src/settings/proxySettings.ts
@@ -152,7 +152,7 @@ export function jvmArgsContainsProxySettings(jvmArgs: string): boolean {
);
}
-const HOST_AND_PORT_EXTRACTOR = /https?:\/\/([^:/]+)(?::([0-9]+))?/;
+const HOST_AND_PORT_EXTRACTOR = /(?:https?:\/\/)?([^:/]+)(?::([0-9]+))?/;
const JVM_PROXY_HOST = 'http.proxyHost';
const JVM_PROXY_PORT = 'http.proxyPort'; |
Signed-off-by: azerr <azerr@redhat.com>
6875f50
to
32508ef
Compare
Thanks @datho7561 ! It seems it is working pretty well. Please merge the PR if you think it is good. |
Thanks for fixing this, Angelo! |
This PR should fix the following problem:
reported at #154 (comment)
I think to reproduce the problem, proxy address have a wrong format (don't start with
https://
)A simple test that I did in debug is: