Skip to content

Commit

Permalink
Optimize empty check for BinaryData (#889)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marcominerva authored Nov 13, 2024
1 parent a973c41 commit 829d2bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion service/Core/Handlers/TextPartitioningHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 829d2bc

Please sign in to comment.