From dd689fd4a65d62832312b00b53835d973e1a8a36 Mon Sep 17 00:00:00 2001 From: Hunter Kehoe Date: Sat, 8 Oct 2022 17:20:14 -0600 Subject: [PATCH] strip trailing slash in "use another server" URL fixes #428 --- web/src/components/SubscribeDialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/components/SubscribeDialog.js b/web/src/components/SubscribeDialog.js index 9ab5a08..d0c024e 100644 --- a/web/src/components/SubscribeDialog.js +++ b/web/src/components/SubscribeDialog.js @@ -90,6 +90,13 @@ const SubscribePage = (props) => { return validTopic(topic) && !isExistingTopicUrl; } })(); + const updateBaseUrl = (ev, newVal) => { + if (validUrl(newVal)) { + props.setBaseUrl(newVal.replace(/\/$/, '')); // strip traililng / after https?:// + } else { + props.setBaseUrl(newVal); + } + }; return ( <> {t("subscribe_dialog_subscribe_title")} @@ -128,7 +135,7 @@ const SubscribePage = (props) => { options={existingBaseUrls} sx={{ maxWidth: 400 }} inputValue={props.baseUrl} - onInputChange={(ev, newVal) => props.setBaseUrl(newVal)} + onInputChange={updateBaseUrl} renderInput={ (params) =>