Skip to content

Commit

Permalink
Pipe the response
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Aug 14, 2024
1 parent 9323fbc commit ccfdfe2
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions apps/meteor/server/routes/avatar/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,8 @@ export const userAvatar = async function (req, res) {

if (settings.get('Accounts_AvatarExternalProviderUrl') !== '' && settings.get('Accounts_AvatarExternalProviderProxy')) {
const response = await fetch(settings.get('Accounts_AvatarExternalProviderUrl').replace('{username}', requestUsername));
if (response.status === 200) {
const blob = Buffer.from(await response.arrayBuffer(), 'base64');
res.writeHead(200, {
'Content-Type': response.headers.get('content-type'),
'Content-Length': blob.length,
});
res.end(blob);
return;
}
response.body.pipe(res);
return;
}

// if still using "letters fallback"
Expand Down

0 comments on commit ccfdfe2

Please sign in to comment.