File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/projects/detail/components/timeline/LinkItem Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ class LinkItem extends React.Component {
8888 // fallback to no-type if type is not supported to avoid errors due to lack of styles
8989 const type = _ . includes ( supportedTypes , link . type ) ? link . type : ''
9090
91+ // if URL doesn't have protocol, then add `https`
92+ const url = link . url . match ( / ^ [ a - z A - Z ] { 3 , } : \/ \/ .+ / ) ? link . url : `https://${ link . url } `
93+
9194 return (
9295 < div
9396 styleName = { cn (
@@ -102,7 +105,7 @@ class LinkItem extends React.Component {
102105 < div styleName = "label-layer" >
103106 < div styleName = "link-item-text-group" >
104107 < a
105- href = { link . url }
108+ href = { url }
106109 styleName = { cn ( 'title' , type ) }
107110 target = "_blank"
108111 rel = "noopener noreferrer"
@@ -112,7 +115,7 @@ class LinkItem extends React.Component {
112115
113116 < div styleName = "link-wrapper" >
114117 < a
115- href = { link . url }
118+ href = { url }
116119 styleName = "link"
117120 target = "_blank"
118121 rel = "noopener noreferrer"
@@ -132,7 +135,7 @@ class LinkItem extends React.Component {
132135
133136 { ! ! link . isDownloadable && ! updateLink && ! deleteLink && ! onSelectChange && (
134137 < a
135- href = { link . url }
138+ href = { url }
136139 styleName = "button download"
137140 target = "_blank"
138141 rel = "noopener noreferrer"
You can’t perform that action at this time.
0 commit comments