1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

Seek to origin of MemoryStream before use (#1916)

This commit is contained in:
Matt Gibson 2022-03-16 11:01:16 -04:00 committed by GitHub
parent a964dfd774
commit eee5caf1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,12 +265,14 @@ namespace Bit.Admin.Controllers
model.InstallationId.Value, model.Version); model.InstallationId.Value, model.Version);
var ms = new MemoryStream(); var ms = new MemoryStream();
await JsonSerializer.SerializeAsync(ms, license, JsonHelpers.Indented); await JsonSerializer.SerializeAsync(ms, license, JsonHelpers.Indented);
ms.Seek(0, SeekOrigin.Begin);
return File(ms, "text/plain", "bitwarden_organization_license.json"); return File(ms, "text/plain", "bitwarden_organization_license.json");
} }
else if (user != null) else if (user != null)
{ {
var license = await _userService.GenerateLicenseAsync(user, null, model.Version); var license = await _userService.GenerateLicenseAsync(user, null, model.Version);
var ms = new MemoryStream(); var ms = new MemoryStream();
ms.Seek(0, SeekOrigin.Begin);
await JsonSerializer.SerializeAsync(ms, license, JsonHelpers.Indented); await JsonSerializer.SerializeAsync(ms, license, JsonHelpers.Indented);
return File(ms, "text/plain", "bitwarden_premium_license.json"); return File(ms, "text/plain", "bitwarden_premium_license.json");
} }