diff --git a/src/modules/common/components/external-links-editor.jsx b/src/modules/common/components/external-links-editor.jsx index ca641be4..32077408 100644 --- a/src/modules/common/components/external-links-editor.jsx +++ b/src/modules/common/components/external-links-editor.jsx @@ -25,7 +25,15 @@ export default class ExternalLinksEditor extends React.Component { handleInputChange(index, event) { const urls = this.props.urls; - urls[index][event.target.name] = event.target.value; + const { name, type, value } = event.target; + + let sanitisedValue = value; + if (type === 'url' && value.length > 4) { + const isURL = value.substring(0, 4) === 'http'; + sanitisedValue = isURL ? value : ''; + } + + urls[index][name] = sanitisedValue; this.props.onChange(urls); } @@ -50,18 +58,21 @@ export default class ExternalLinksEditor extends React.Component {