Home / Function/ getAvatarUrl() — supabase Function Reference

getAvatarUrl() — supabase Function Reference

Architecture documentation for the getAvatarUrl() function in Users.utils.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  d44a1c3b_079d_7fa6_71ab_78eb4daff73a["getAvatarUrl()"]
  7311069a_4070_4e94_d8d3_5eaf335ec311["formatUsersData()"]
  7311069a_4070_4e94_d8d3_5eaf335ec311 -->|calls| d44a1c3b_079d_7fa6_71ab_78eb4daff73a
  c1673233_a37e_6c09_2909_6f7383199c11["UserRoleButtonSection()"]
  c1673233_a37e_6c09_2909_6f7383199c11 -->|calls| d44a1c3b_079d_7fa6_71ab_78eb4daff73a
  0108b321_bf04_8eea_b20a_c0acdce2a1bd["UserImpersonatingRow()"]
  0108b321_bf04_8eea_b20a_c0acdce2a1bd -->|calls| d44a1c3b_079d_7fa6_71ab_78eb4daff73a
  51e34b0e_c81d_3dde_aa5f_10240c603a54["UserRow()"]
  51e34b0e_c81d_3dde_aa5f_10240c603a54 -->|calls| d44a1c3b_079d_7fa6_71ab_78eb4daff73a
  style d44a1c3b_079d_7fa6_71ab_78eb4daff73a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Auth/Users/Users.utils.tsx lines 214–253

export function getAvatarUrl(user: User): string | undefined {
  const {
    avatarUrl,
    avatarURL,
    avatar_url,
    profileUrl,
    profileURL,
    profile_url,
    profileImage,
    profile_image,
    profileImageUrl,
    profileImageURL,
    profile_image_url,
  } = user.raw_user_meta_data ?? {}

  const url = (avatarUrl ||
    avatarURL ||
    avatar_url ||
    profileImage ||
    profile_image ||
    profileUrl ||
    profileURL ||
    profile_url ||
    profileImageUrl ||
    profileImageURL ||
    profile_image_url ||
    '') as unknown

  if (typeof url !== 'string') return undefined
  const isSupported = SUPPORTED_CSP_AVATAR_URLS.some((x) => url.startsWith(x))

  // [Joshen] Only for GH, not entirely sure whats the image transformation equiv for Google
  try {
    const _url = new URL(url)
    _url.searchParams.set('s', '24')
    return isSupported ? (url.startsWith(GITHUB_AVATAR_URL) ? _url.href : url) : undefined
  } catch (error) {
    return isSupported ? url : undefined
  }
}

Subdomains

Frequently Asked Questions

What does getAvatarUrl() do?
getAvatarUrl() is a function in the supabase codebase.
What calls getAvatarUrl()?
getAvatarUrl() is called by 4 function(s): UserImpersonatingRow, UserRoleButtonSection, UserRow, formatUsersData.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free