mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
core: optional input
This commit is contained in:
1 parent
ce880b4e05
commit
30710cdbfb
2 files changed
+2
-2
No files matched your search
@@ -9,7 +9,7 @@ export const providers: Record<string, AvatarProvider> = {
|
||||
};
|
||||
|
||||
function avatar(src: string, size = 64) {
|
||||
const index = src.indexOf(':');
|
||||
const index = (src || '').indexOf(':');
|
||||
if (index === -1) return providers.gravatar('', size);
|
||||
const [provider, str] = [src.substr(0, index), src.substr(index + 1, src.length)];
|
||||
if (!providers[provider] || !str) return providers.gravatar('', size);
|
||||
|
||||
Reference in new issue
Block a user