From 736531b05f8cab0f3fc536df359adf72bd155a9c Mon Sep 17 00:00:00 2001 From: Marco Minerva Date: Wed, 13 Nov 2024 10:28:04 +0100 Subject: [PATCH] Optimize empty check for BinaryData Updated the condition to check if `partitionContent` is empty by using the `IsEmpty` property instead of converting it to a byte array and checking its length. This change improves efficiency and readability. --- service/Core/Handlers/TextPartitioningHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/Core/Handlers/TextPartitioningHandler.cs b/service/Core/Handlers/TextPartitioningHandler.cs index 1d12c1153..9ac57da4a 100644 --- a/service/Core/Handlers/TextPartitioningHandler.cs +++ b/service/Core/Handlers/TextPartitioningHandler.cs @@ -120,7 +120,7 @@ public TextPartitioningHandler( string partitionsMimeType = MimeTypes.PlainText; // Skip empty partitions. Also: partitionContent.ToString() throws an exception if there are no bytes. - if (partitionContent.ToArray().Length == 0) { continue; } + if (partitionContent.IsEmpty) { continue; } switch (file.MimeType) {