diff --git a/src/plugins/relay/relay-remote.c b/src/plugins/relay/relay-remote.c index 15dc42b50..f7d9becb4 100644 --- a/src/plugins/relay/relay-remote.c +++ b/src/plugins/relay/relay-remote.c @@ -252,6 +252,9 @@ relay_remote_get_address (const char *url) return NULL; pos = strchr (ptr_start, ':'); + if (!pos) + pos = strchr (ptr_start, '?'); + return (pos) ? weechat_strndup (ptr_start, pos - ptr_start) : strdup (ptr_start); } diff --git a/tests/unit/plugins/relay/test-relay-remote.cpp b/tests/unit/plugins/relay/test-relay-remote.cpp index aab1f032f..e2c7816a8 100644 --- a/tests/unit/plugins/relay/test-relay-remote.cpp +++ b/tests/unit/plugins/relay/test-relay-remote.cpp @@ -127,6 +127,8 @@ TEST(RelayRemote, GetAddress) STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com")); STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000")); STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000/")); + STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000/?option=1")); + STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com?option=1")); } /*