Skip to content

Fix metadata parsing for large numbers in XML responses#1381

Merged
prakashsvmx merged 5 commits intominio:masterfrom
TzachiSh:patch-2
Feb 10, 2025
Merged

Fix metadata parsing for large numbers in XML responses#1381
prakashsvmx merged 5 commits intominio:masterfrom
TzachiSh:patch-2

Conversation

@TzachiSh
Copy link
Copy Markdown
Contributor

@TzachiSh TzachiSh commented Feb 5, 2025

Fix metadata parsing for large numbers in XML responses

Description

Fixed an issue with metadata parsing where large numbers in XML responses were being incorrectly handled due to BigInt conversion. Updated XMLParser configuration to properly handle leading zeros and maintain string representation of large numbers.

Changes

  • Added numberParseOptions to XMLParser configuration
  • Set leadingZeros: true to preserve leading zeros in numeric strings
  • Set eNotation: false to prevent scientific notation conversion
  • Set hex: true to properly handle hexadecimal values

Problem

Previously, large numbers in metadata could be incorrectly parsed or lose precision when converted to JavaScript numbers, especially when dealing with BigInt values.

Solution

Updated XMLParser initialization with proper number parsing options to maintain string representation of numeric values and preserve leading zeros.

Testing

  • Tested with large number metadata values
  • Verified leading zeros are preserved
  • Confirmed BigInt values are correctly handled

@prakashsvmx prakashsvmx merged commit 27c1d51 into minio:master Feb 10, 2025
12 checks passed
@TzachiSh TzachiSh deleted the patch-2 branch March 6, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants