fix: handling invalid import environment names (#2197)
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:
Old behaviour
New behaviour
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.
There are already two PR regarding this problem:
#1761
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.
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.