Skip to content

Commit

Permalink
Revert mis-merge in abstractauditlog
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Dec 26, 2024
1 parent 6904317 commit 17bca93
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -584,22 +584,24 @@ public void logDocumentWritten(ShardId shardId, GetResult originalResult, Index
originalSource = "{}";
}
if (securityIndicesMatcher.test(shardId.getIndexName())) {
try (
XContentParser parser = XContentHelper.createParser(
NamedXContentRegistry.EMPTY,
THROW_UNSUPPORTED_OPERATION,
originalResult.internalSourceRef(),
XContentType.JSON
)
) {
Object base64 = parser.map().values().iterator().next();
if (base64 instanceof String) {
originalSource = (new String(BaseEncoding.base64().decode((String) base64), StandardCharsets.UTF_8));
} else {
originalSource = XContentHelper.convertToJson(originalResult.internalSourceRef(), false, XContentType.JSON);
if (originalSource == null) {
try (
XContentParser parser = XContentHelper.createParser(
NamedXContentRegistry.EMPTY,
THROW_UNSUPPORTED_OPERATION,
originalResult.internalSourceRef(),
XContentType.JSON
)
) {
Object base64 = parser.map().values().iterator().next();
if (base64 instanceof String) {
originalSource = (new String(BaseEncoding.base64().decode((String) base64), StandardCharsets.UTF_8));
} else {
originalSource = XContentHelper.convertToJson(originalResult.internalSourceRef(), false, XContentType.JSON);
}
} catch (Exception e) {
log.error(e.toString());
}
} catch (Exception e) {
log.error(e.toString());
}

try (
Expand Down Expand Up @@ -640,7 +642,7 @@ public void logDocumentWritten(ShardId shardId, GetResult originalResult, Index
}
}

if (!complianceConfig.shouldLogWriteMetadataOnly()) {
if (!complianceConfig.shouldLogWriteMetadataOnly() && !complianceConfig.shouldLogDiffsForWrite()) {
if (securityIndicesMatcher.test(shardId.getIndexName())) {
// current source, normally not null or empty
try (
Expand Down

0 comments on commit 17bca93

Please sign in to comment.