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: Ignore Brackets Inside Strings in getPartsOfArrayContent #1268

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Karan-Palan
Copy link
Contributor

What kind of change does this PR introduce?

Bugfix: Ensures brackets inside strings are ignored during parsing in the getPartsOfArrayContent function.

Issue Number:

Screenshots/videos:
N/A

If relevant, did you update the documentation?

No updates required as this is a bugfix to existing functionality.

Summary

This pull request addresses a parsing error in the getPartsOfArrayContent function in lib/getPartsOfJson.ts. The function previously failed to ignore brackets ({, }, [, ]) that appear inside strings, leading to incorrect parsing of JSON arrays.

Before:
Example Input:

[
  "{key:value}",
  "[nested]",
  "\"A String with {brackets}\"",
  "true",
  143,
  null
]

After:
The function now correctly parses the array values and ignores brackets inside strings.

Does this PR introduce a breaking change?
No breaking changes.

@Karan-Palan Karan-Palan requested a review from a team as a code owner January 9, 2025 16:45
Copy link

github-actions bot commented Jan 9, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview b7c96a0

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (72ae168) to head (b7c96a0).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1268   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          373       373           
  Branches        94        94           
=========================================
  Hits           373       373           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@DhairyaMajmudar DhairyaMajmudar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awsm work here @Karan-Palan, LGTM 👍🏻

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.

🐛 Bug: Incorrect Bracket Filtering in Strings within getPartsOfArrayContent
2 participants