Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix metadata parsing for large numbers in XML responses #1381

Merged
merged 5 commits into from
Feb 10, 2025

Conversation

TzachiSh
Copy link
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
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