Skip to content
Snippets Groups Projects
Commit 5eb213dc authored by Alexandre Eberhardt's avatar Alexandre Eberhardt
Browse files

Server name: regex accepts "-"

"my-jams-server.domain.com" is now a valid name

GitLab: #152
Change-Id: I83c9e287fdcc718df9d2578ee3dafbc9dd04a78c
parent 619af71f
No related branches found
No related tags found
No related merge requests found
...@@ -142,8 +142,10 @@ export default function ServerParameters({ ...@@ -142,8 +142,10 @@ export default function ServerParameters({
function handleSubmit(values: Settings) { function handleSubmit(values: Settings) {
let jsonData = {}; let jsonData = {};
const re = new RegExp(/^http[s]?:\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/); const re = new RegExp(
const nohttpre = new RegExp(/^\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/); /^http[s]?:\/\/[\w-]+(\.[\w-]+)*(:[0-9]+)?\/?(\/[.\w-]*)*$/
);
const nohttpre = new RegExp(/^[\w-]+(\.[\w-]+)*(:[0-9]+)?\/?(\/[.\w-]*)*$/);
if (values.domain.match(nohttpre)) if (values.domain.match(nohttpre))
values.domain = window.location.protocol + "//" + values.domain; values.domain = window.location.protocol + "//" + values.domain;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment