1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

Fix queue message encoding for Azure (UTF-16 in XML) (#1439)

* Revert "Encode into b64 to avoid illegal xml encoding when sending to Azure (#1425)"

This reverts commit 2c9a5bb4ab.

* Azure queue to use base64 encoding universally

* Ensure byte size calc is using encoded byte count

* Remove message text extension from blockIP svc

* Remove unused using on blockIp hosted service
This commit is contained in:
Chad Scharf
2021-07-07 10:49:59 -04:00
committed by GitHub
parent 908e1504af
commit 898c7baf89
6 changed files with 78 additions and 76 deletions

View File

@ -18,7 +18,6 @@ namespace Bit.EventsProcessor
{
public class AzureQueueHostedService : IHostedService, IDisposable
{
private readonly JsonSerializer _jsonSerializer;
private readonly ILogger<AzureQueueHostedService> _logger;
private readonly IConfiguration _configuration;
@ -33,11 +32,6 @@ namespace Bit.EventsProcessor
{
_logger = logger;
_configuration = configuration;
_jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings
{
Converters = new[] { new EncodedStringConverter() },
});
}
public Task StartAsync(CancellationToken cancellationToken)
@ -84,7 +78,7 @@ namespace Bit.EventsProcessor
{
foreach (var message in messages.Value)
{
await ProcessQueueMessageAsync(message.MessageText, cancellationToken);
await ProcessQueueMessageAsync(message.DecodeMessageText(), cancellationToken);
await _queueClient.DeleteMessageAsync(message.MessageId, message.PopReceipt);
}
}
@ -118,7 +112,7 @@ namespace Bit.EventsProcessor
var token = JToken.Parse(message);
if (token is JArray)
{
var indexedEntities = token.ToObject<List<EventMessage>>(_jsonSerializer)
var indexedEntities = token.ToObject<List<EventMessage>>()
.SelectMany(e => EventTableEntity.IndexEvent(e));
events.AddRange(indexedEntities);
}