File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,13 @@ function sanitizeGitHubHTML(html: string | null): string | null {
9797 * Handles "undefined" strings, empty values, or purely whitespace strings.
9898 * Prevents UI issues with empty icons or broken conditional logic.
9999 */
100- function cleanString ( val : string | null ) : string | null {
100+ function cleanString ( val : string | null , url = false ) : string | null {
101101 if ( ! val || val === 'undefined' || val . trim ( ) === '' ) return null
102- return val . trim ( )
102+ val = val . trim ( )
103+ if ( ! url ) {
104+ return val
105+ }
106+ return val . startsWith ( 'https://' ) || val . startsWith ( 'http:' ) ? val : null
103107}
104108
105109/**
@@ -158,7 +162,7 @@ async function fetchGitHubUserData(
158162 // Rich HTML sanitization for company mentions/orgs
159163 companyHTML : sanitizeGitHubHTML ( user . companyHTML ) ,
160164 location : cleanString ( user . location ) ,
161- websiteUrl : cleanString ( user . websiteUrl ) ,
165+ websiteUrl : cleanString ( user . websiteUrl , true ) ,
162166 twitterUsername : cleanString ( user . twitterUsername ) ,
163167 } )
164168 }
You can’t perform that action at this time.
0 commit comments