File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,13 +135,17 @@ export function generateReadme(state: GeneratorState): string {
135135 . map ( ( id ) => {
136136 const social = getSocialById ( id ) ;
137137 if ( ! social ) return null ;
138- const url = state . socialLinks [ id ] ;
139- const resolvedUrl =
138+ const rawUrl = state . socialLinks [ id ] ?. trim ( ) || '' ;
139+ let resolvedUrl =
140140 social . id === 'email'
141- ? `mailto:${ url . replace ( / ^ m a i l t o : / i, '' ) } `
142- : url . startsWith ( 'http' )
143- ? url
144- : `${ social . baseUrl } ${ url } ` ;
141+ ? `mailto:${ rawUrl . replace ( / ^ m a i l t o : / i, '' ) } `
142+ : rawUrl . startsWith ( 'http' )
143+ ? rawUrl
144+ : `${ social . baseUrl || '' } ${ rawUrl } ` ;
145+
146+ if ( social . id !== 'email' && ! / ^ h t t p s ? : \/ \/ / i. test ( resolvedUrl ) ) {
147+ resolvedUrl = `https://${ resolvedUrl } ` ;
148+ }
145149
146150 if ( social . type === 'simpleicon' && social . siSlug ) {
147151 return [
You can’t perform that action at this time.
0 commit comments