Allow base URL with path

Ignore and remove trailing slashes.
Fixes #134.

Change-Id: Iedf266e9a93e6939f7f66707fee59a2b56226216
pull/142/head
Manuel Stahl 3 years ago
parent 0bc1ce3226
commit e2fd934851

@ -111,7 +111,9 @@ const LoginPage = ({ theme }) => {
if (!values.base_url.match(/^(http|https):\/\//)) { if (!values.base_url.match(/^(http|https):\/\//)) {
errors.base_url = translate("synapseadmin.auth.protocol_error"); errors.base_url = translate("synapseadmin.auth.protocol_error");
} else if ( } else if (
!values.base_url.match(/^(http|https):\/\/[a-zA-Z0-9\-.]+(:\d{1,5})?$/) !values.base_url.match(
/^(http|https):\/\/[a-zA-Z0-9\-.]+(:\d{1,5})?[^?&\s]*$/
)
) { ) {
errors.base_url = translate("synapseadmin.auth.url_error"); errors.base_url = translate("synapseadmin.auth.url_error");
} }

@ -18,6 +18,7 @@ const authProvider = {
// use the base_url from login instead of the well_known entry from the // use the base_url from login instead of the well_known entry from the
// server, since the admin might want to access the admin API via some // server, since the admin might want to access the admin API via some
// private address // private address
base_url = base_url.replace(/\/+$/g, "");
localStorage.setItem("base_url", base_url); localStorage.setItem("base_url", base_url);
const decoded_base_url = window.decodeURIComponent(base_url); const decoded_base_url = window.decodeURIComponent(base_url);

Loading…
Cancel
Save