mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.23.7",
|
||||
"version": "2.23.8",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -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