Skip to content

Commit

Permalink
fix stream handling
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Dec 2, 2023
1 parent e8821e2 commit 2663c81
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ public async Task<string> GetGraphApiProfilePhoto(string oid)
var photo = string.Empty;
byte[] photoByte;

var streamPhoto = new MemoryStream();
using (var photoStream = await _graphServiceClient.Users[oid].Photo
.Content.GetAsync())
{
photoByte = ((MemoryStream)photoStream!).ToArray();
photoStream!.CopyTo(streamPhoto);
photoByte = streamPhoto!.ToArray();
}

using var imageFromFile = new MagickImage(photoByte);
Expand Down

0 comments on commit 2663c81

Please sign in to comment.