Fix several file processings (#2968)

* Ignore image error in person

* Fix hang while processing empty file
This commit is contained in:
MeiMei 2018-10-21 18:35:36 +09:00 committed by syuilo
parent b8ed8336e0
commit 72754ede4e
2 changed files with 6 additions and 2 deletions

View File

@ -190,7 +190,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<IU
].map(img => ].map(img =>
img == null img == null
? Promise.resolve(null) ? Promise.resolve(null)
: resolveImage(user, img) : resolveImage(user, img).catch(() => null)
))); )));
const avatarId = avatar ? avatar._id : null; const avatarId = avatar ? avatar._id : null;
@ -276,7 +276,7 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
].map(img => ].map(img =>
img == null img == null
? Promise.resolve(null) ? Promise.resolve(null)
: resolveImage(exist, img) : resolveImage(exist, img).catch(() => null)
))); )));
// Update user // Update user

View File

@ -185,6 +185,10 @@ export default async function(
// 種類が同定できなかったら application/octet-stream にする // 種類が同定できなかったら application/octet-stream にする
res(['application/octet-stream', null]); res(['application/octet-stream', null]);
} }
})
.on('end', () => {
// maybe 0 bytes
res(['application/octet-stream', null]);
}); });
}); });