Guard `isValidImageUrl` against nullish `avatar_url` inputs (#5172) * Initial plan * fix: guard isValidImageUrl against nullish input Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -857,7 +857,7 @@ function updateGroupAvatar(group) { | |||
| 857 | */ | 857 | */ |
| 858 | function isValidImageUrl(url) { | 858 | function isValidImageUrl(url) { |
| 859 | // check if empty dict | 859 | // check if empty dict |
| 860 | if (Object.keys(url).length === 0) { | 860 | if (!url || Object.keys(url).length === 0) { |
| 861 | return false; | 861 | return false; |
| 862 | } | 862 | } |
| 863 | return isDataURL(url) || (url && (url.startsWith('user') || url.startsWith('/user'))); | 863 | return isDataURL(url) || (url && (url.startsWith('user') || url.startsWith('/user'))); |