usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.4k stars 1.16k forks source link

Non-ASCII alphabets are converted to "-" during import #2693

Open hrmon opened 1 month ago

hrmon commented 1 month ago

I have checked the following:

Describe the bug

When importing a collection, a function named normalizeFileName is applied to the items' names. This function uses this replacement:

// Remove any characters that are not alphanumeric, spaces, hyphens, or underscores
...
name.replace(/[^\w\s-]/g, '-');

But, this will replace the non-ASCII alphabets (like Persian) with "-". I was wondering why such a normalization is needed at all. If it is necessary, can we make it work with non-ASCII alphabets?

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

jwetzell commented 1 month ago

Seems to be an intentional choice to limit the supported characters in filenames when importing. Despite the variable in that function being called validChars it's actually a regex that matches "INVALID" characters and replaces them with a hyphen (-)

hrmon commented 1 month ago

But the editor allows using such characters. Why is such a limitation only applied when importing?