Skip to content

fix(envvars): fix split for pasting envvars with query params#1156

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/envvars
Aug 28, 2025
Merged

fix(envvars): fix split for pasting envvars with query params#1156
waleedlatif1 merged 1 commit intostagingfrom
fix/envvars

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

fix split for pasting envvars with query params

Type of Change

  • Bug fix

Testing

Fix splitting envvars with query params

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 28, 2025 2:55am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 28, 2025 2:55am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR fixes a critical bug in the environment variable paste handling functionality within the settings modal. The issue occurred when users pasted environment variables containing URLs with query parameters or other values with multiple = characters. The original implementation used split('=') which would incorrectly break these values into multiple parts, corrupting the data.

The fix introduces two key improvements:

  1. Smarter parsing logic: Replaces split('=') with indexOf('=') to find only the first equals sign and treat everything after it as the complete value, preserving URLs and other complex values intact
  2. Environment variable name validation: Adds regex validation (/^[A-Za-z_][A-Za-z0-9_]*$/) to ensure only properly formatted environment variable names are treated as keys during paste operations

The changes are contained within the handleKeyValuePaste function in the environment variables component, which is responsible for processing clipboard content when users paste key-value pairs. This component is part of the settings modal's environment management interface, allowing users to efficiently manage their application's environment variables. The fix ensures that legitimate environment variable values containing = characters (such as API endpoints with query parameters) are preserved correctly while maintaining the ability to parse actual key-value pairs from pasted content.

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it addresses a specific parsing bug without affecting other functionality
  • Score reflects targeted bug fix with improved validation logic that maintains backward compatibility while fixing the core issue
  • Pay close attention to the environment variable parsing logic in the handleKeyValuePaste function

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 389456e into staging Aug 28, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/envvars branch August 28, 2025 02:55
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
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.

1 participant