bruno icon indicating copy to clipboard operation
bruno copied to clipboard

fix: handling invalid import environment names (#2197)

Open igor-topolski opened this issue 1 year ago • 3 comments

Description

Resolves: #2197

This PR effectively addresses the issue I raised (#2197). To ensure no clashes and unexpected behaviours, I've implemented a solution that displays a descriptive error instead of automatically resolving issues (unlike in the case of collections). This prevents multiple environments from having the same name, e.g. My / Environment / Name and My : Environment : Name would be translated into the same My - Environment - Name if the same strategy (as for collections) was used.

If the Postman collection contains any of the following: <, >, :, ", /, \, |, ?, *, the import will fail with the following message: The environment name contains one or more illegal characters (<, >, :, ", /, \, |, ?, *).

Problematic payload: image

Old behaviour image

New behaviour image

Contribution Checklist:

  • [x] The pull request only addresses one issue or adds one feature.
  • [x] The pull request does not introduce any breaking changes
  • [x] I have added screenshots or gifs to help explain the change if applicable.
  • [x] I have read the contribution guidelines.
  • [x] Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

igor-topolski avatar Apr 29 '24 16:04 igor-topolski

There are already two PR regarding this problem:

#1761

end3rbyte avatar May 01 '24 08:05 end3rbyte

There are already two PR regarding this problem:

#1761 #1651

Thanks for pointing it out, it looks like other solutions are erroneous though as they will not work correctly for e.g. Some / Invalid / Name. Also, they risk name clash, e.g. Some / Env and Some [ Env with results in the same name.

igor-topolski avatar May 01 '24 10:05 igor-topolski

If you don't mind I made a PR that is more consistent with the collection import, and don't bother the user to go back to the postman environment and change the name.

end3rbyte avatar May 01 '24 10:05 end3rbyte