From 6e916112381b265a0432ddc6b45e6894c0482141 Mon Sep 17 00:00:00 2001 From: Philipp Hanslovsky Date: Wed, 1 Mar 2023 22:35:33 -0500 Subject: [PATCH 1/3] Add additional check to prevent false positive endpoints --- src/jgo/jgo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jgo/jgo.py b/src/jgo/jgo.py index bd2b328..bef3ccc 100644 --- a/src/jgo/jgo.py +++ b/src/jgo/jgo.py @@ -152,6 +152,7 @@ def is_endpoint(string): len(endpoint_elements) < 2 or len(endpoint_elements) > 5 or endpoint_elements[0].startswith("-") + or endpoint_elements[1].startswith("/") ): return False From e0269fb9e88bb159a678ad59b896d8ed7529aed5 Mon Sep 17 00:00:00 2001 From: Philipp Hanslovsky Date: Thu, 2 Mar 2023 13:31:44 -0500 Subject: [PATCH 2/3] Revert "Add additional check to prevent false positive endpoints" This reverts commit 6e916112381b265a0432ddc6b45e6894c0482141. --- src/jgo/jgo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/jgo/jgo.py b/src/jgo/jgo.py index bef3ccc..bd2b328 100644 --- a/src/jgo/jgo.py +++ b/src/jgo/jgo.py @@ -152,7 +152,6 @@ def is_endpoint(string): len(endpoint_elements) < 2 or len(endpoint_elements) > 5 or endpoint_elements[0].startswith("-") - or endpoint_elements[1].startswith("/") ): return False From a5b4226b5884f59dc4392a27c0dbdbb4df4c6c1e Mon Sep 17 00:00:00 2001 From: Philipp Hanslovsky Date: Thu, 2 Mar 2023 13:37:14 -0500 Subject: [PATCH 3/3] Exclude grpc:// from potential endpoint strings --- src/jgo/jgo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jgo/jgo.py b/src/jgo/jgo.py index bd2b328..53f9b3f 100644 --- a/src/jgo/jgo.py +++ b/src/jgo/jgo.py @@ -271,7 +271,7 @@ def run_and_combine_outputs(command, *args): def find_endpoint(argv, shortcuts={}): # endpoint is first positional argument - pattern = re.compile("(.*https?://.*|[a-zA-Z]:\\.*)") + pattern = re.compile("(.*(https?|grpc)://.*|[a-zA-Z]:\\.*)") indices = [] for index, arg in enumerate(argv): if arg in shortcuts or (Endpoint.is_endpoint(arg) and not pattern.match(arg)):