This commit is contained in:
Ewout Stortenbeker 2022-05-31 15:11:54 +02:00
commit 0f25a54b58

View file

@ -58,12 +58,13 @@ export const addRoute = (env: RouteInitEnvironment) => {
if (contentType === 'image/png') { //state.provider === 'google' &&
// Don't accept image/png, because it's probably a placeholder image. Google does this by creating a png with people's initials
user_details.picture = [];
return;
}
const image = await response.arrayBuffer();
let buff = Buffer.from(image);
best.url = `data:${contentType};base64,${buff.toString('base64')}`;
user_details.picture = [best]; // Only keep the best one
else {
const image = await response.arrayBuffer();
let buff = Buffer.from(image);
best.url = `data:${contentType};base64,${buff.toString('base64')}`;
user_details.picture = [best]; // Only keep the best one
}
}
catch(err) {
env.debug.warn(`Could not fetch profile picture from "${best.url}": `, err);