mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-26 23:53:21 +03:00
Merge pull request #432 from wunter8/428-server-url-trailing-slash
strip trailing slash in "use another server" URL
This commit is contained in:
commit
d48619a940
@ -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>
|
||||
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user