mirror of
https://github.com/bitwarden/server.git
synced 2025-07-08 03:15:07 -05:00
Encode into b64 to avoid illegal xml encoding when sending to Azure (#1425)
* Encode into b64 to avoid illegal xml encoding when sending to Azure
* Revert "Encode into b64 to avoid illegal xml encoding when sending to Azure"
This reverts commit d50de941da
.
* HtmlEncode strings if they use multi-byte characters
* Add serializer to event processor
* Rename to used class
* Formatting
* PR feedback
This commit is contained in:
@ -12,11 +12,13 @@ using Microsoft.Extensions.Logging;
|
||||
using Azure.Storage.Queues;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.EventsProcessor
|
||||
{
|
||||
public class AzureQueueHostedService : IHostedService, IDisposable
|
||||
{
|
||||
private readonly JsonSerializer _jsonSerializer;
|
||||
private readonly ILogger<AzureQueueHostedService> _logger;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
@ -31,6 +33,11 @@ namespace Bit.EventsProcessor
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
|
||||
_jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings
|
||||
{
|
||||
Converters = new[] { new EncodedStringConverter() },
|
||||
});
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
@ -111,7 +118,7 @@ namespace Bit.EventsProcessor
|
||||
var token = JToken.Parse(message);
|
||||
if (token is JArray)
|
||||
{
|
||||
var indexedEntities = token.ToObject<List<EventMessage>>()
|
||||
var indexedEntities = token.ToObject<List<EventMessage>>(_jsonSerializer)
|
||||
.SelectMany(e => EventTableEntity.IndexEvent(e));
|
||||
events.AddRange(indexedEntities);
|
||||
}
|
||||
|
Reference in New Issue
Block a user