Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

563 B
Raw Blame
/**
 * Resolve a user's raw `avatar` field to an <img src>.
 *
 * The value is either an uploaded file name (served from /uploads/avatars) or,
 * for SSO users who never uploaded one, an absolute https URL from their OIDC
 * `picture` claim (#1399), which is used as-is. Server responses usually expose a
 * pre-resolved `avatar_url`; use this only where components read the raw field.
 */
export function avatarSrc(avatar?: string | null): string | null {
  if (!avatar) return null
  return /^https:\/\//i.test(avatar) ? avatar : `/uploads/avatars/${avatar}`
}