Skip to content

Commit

Permalink
Merge pull request #432 from wunter8/428-server-url-trailing-slash
Browse files Browse the repository at this point in the history
strip trailing slash in "use another server" URL
  • Loading branch information
binwiederhier committed Oct 9, 2022
2 parents cbc912d + dd689fd commit d48619a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/src/components/SubscribeDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<DialogTitle>{t("subscribe_dialog_subscribe_title")}</DialogTitle>
Expand Down Expand Up @@ -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) =>
<TextField
{...params}
Expand Down

0 comments on commit d48619a

Please sign in to comment.