Skip to content

fix: curl import issue when parse the pair value#9198

Merged
ZxBing0066 merged 5 commits into
developfrom
fix/curl-import-parse-issue
Oct 9, 2025
Merged

fix: curl import issue when parse the pair value#9198
ZxBing0066 merged 5 commits into
developfrom
fix/curl-import-parse-issue

Conversation

@ZxBing0066
Copy link
Copy Markdown
Member

@ZxBing0066 ZxBing0066 commented Sep 30, 2025

INS-1502
fixes #9163

Changes

Use slice to replace split to avoid string discard when multiple = in the data.

@ZxBing0066 ZxBing0066 requested review from a team and Copilot September 30, 2025 09:41
@ZxBing0066 ZxBing0066 self-assigned this Sep 30, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the cURL importer where strings containing multiple equals signs were incorrectly parsed. The fix replaces the split('=') approach with indexOf and slice to properly handle key-value pairs that have equals signs in their values.

  • Replaced split('=') with indexOf and slice to preserve data after the first equals sign
  • Updated logic to handle cases where no equals sign is present
  • Added comprehensive test cases for various scenarios with multiple equals signs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/insomnia/src/utils/importers/importers/curl.ts Updated pair parsing logic to use slice instead of split for handling multiple equals signs
packages/insomnia/src/utils/importers/importers/curl.test.ts Added test cases to verify correct parsing of data with multiple equals signs

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ZxBing0066 ZxBing0066 enabled auto-merge (squash) October 9, 2025 10:01
@ZxBing0066 ZxBing0066 merged commit 271f724 into develop Oct 9, 2025
13 checks passed
@ZxBing0066 ZxBing0066 deleted the fix/curl-import-parse-issue branch October 9, 2025 10:35
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.

Import From Curl - The equal sign in the body and the subsequent string will be discarded

3 participants