fix: issue 23, handle external URLs in avatar rendering
This commit is contained in:
@@ -45,6 +45,10 @@ export const formatMemberDisplayName = (
|
|||||||
return localPart.replace(/[_-]/g, ".");
|
return localPart.replace(/[_-]/g, ".");
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAvatarUrl = (key: string) => {
|
export const getAvatarUrl = (imageOrKey: string) => {
|
||||||
return `${env("NEXT_PUBLIC_STORAGE_URL")}/${env("NEXT_PUBLIC_AVATAR_BUCKET_NAME")}/${key}`;
|
if (imageOrKey.startsWith("http://") || imageOrKey.startsWith("https://")) {
|
||||||
|
return imageOrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${env("NEXT_PUBLIC_STORAGE_URL")}/${env("NEXT_PUBLIC_AVATAR_BUCKET_NAME")}/${imageOrKey}`;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user