File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import React , { PropTypes } from 'react' ;
44
5+ import { urlify } from '../../services/util' ;
6+
57import EditButtonComponent from '../common/EditButtonComponent' ;
68
79require ( 'styles/user/ProfileHeader.scss' ) ;
@@ -18,7 +20,7 @@ class ProfileHeaderComponent extends React.Component {
1820 { user . website || user . twitter
1921 ? < div className = "profile-header__social" >
2022 { user . website
21- ? < a href = { user . website } target = "_blank" > { user . website } </ a >
23+ ? < a href = { urlify ( user . website ) } target = "_blank" > { user . website } </ a >
2224 : null
2325 }
2426 { user . website && user . twitter
Original file line number Diff line number Diff line change 1+ /**
2+ * Prepend protocol on URL if it isn't present.
3+ * @param {String } urlString
4+ * @return {String } modified URL string
5+ */
6+ export const urlify = function ( urlString ) {
7+ var pat = / ^ h t t p s ? : \/ \/ | ^ \/ \/ / i;
8+ if ( ! pat . test ( urlString ) ) {
9+ urlString = '//' + urlString ;
10+ }
11+ return urlString ;
12+ }
You can’t perform that action at this time.
0 commit comments