[go: nahoru, domu]

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

[Bug] Error importing Postman Collection with [ ] symbols in it's name #1651 #1811

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ialloyd
Copy link
Contributor
@ialloyd ialloyd commented Mar 14, 2024

Fixes an issue with importing Postman collections that have square brackets in their names. This change sanitizes the collection name by removing square brackets, preventing import errors and crashes. Resolves issue #1651.

@helloanoop
Copy link
Contributor

@bpoulaindev Can you review this?

Copy link
Contributor
@bpoulaindev bpoulaindev left a comment

Choose a reason for hiding this comment

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

Works fine on my side, this would also replace a single [ or ] in the name but it's fine.
My IDE suggests a small change in the syntax but the function's behavior remains identical :
image
Work fine even on a hardcore name :
image

@@ -54,7 +54,11 @@ const convertV21Auth = (array) => {
}, {});
};

const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) => {
function sanitizeName(name) {
return name.replace(/\[|\]/g, ''); // This will remove square brackets

Choose a reason for hiding this comment

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

This will not work for Some / Environment / Name as it'll result in Some _ Environment / Name; also, there are more forbidden characters.

Furthermore, this is prone to introduce a silent crash if the user has two environments following the same pattern, e.g. Some / Env and Some [ Env with results in the same name - Some Env.

I proposed a detailed error instead to inform user of the invalid characters (#2200)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants