Skip to content

Commit

Permalink
fix: Allow mailto + tel in absolute reference fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Ostheimer committed Jan 9, 2020
1 parent abe0019 commit 599f27b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/src/Edit/elements/ReferenceInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ReferenceType, SearchResultItem } from "../../../../typings";
import { BasicResultItem } from "../../common/ResultItem";
import { ControllerStateAndHelpers } from "downshift";

const validationRegex = "W*(http:|https:)W*|^/.*$";
const validationRegex = /W*(http:\/\/|https:\/\/|mailto:|tel:)W*|^\/.*$/gm;

const Root = styled("div")`
${inputClass};
Expand Down Expand Up @@ -79,7 +79,7 @@ export default class ReferenceInput extends Component<Props, State> {
if (!value || value.model || !value.id) return;
const check = value.id.toString().match(validationRegex);
if (!check) {
return 'This url is not valid. Links to the same domain need to start with "/" or to other domains with a valid protocol (http/https).';
return 'This url is not valid. Links to the same domain need to start with "/", to other domains with a valid protocol (http/https) or with a valid contact protocol (mailto/tel).';
}
}

Expand Down

0 comments on commit 599f27b

Please sign in to comment.