usebruno / bruno

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

Normalize Filename #2996

Open helloanoop opened 2 months ago

helloanoop commented 2 months ago

Bruno saves requests as files, where the file name is derived from the request name. This can create issues because certain characters are not allowed in file names due to OS constraints.

Currently, we use the following code to normalize file names:

export const normalizeFileName = (name) => {
  if (!name) {
    return name;
  }

  const validChars = /[^\w\s-]/g;
  const formattedName = name.replace(validChars, '-');

  return formattedName;
};

However, this approach has limitations.

To improve this, Bruno supports a name property within each .bru file. This allows us to use any characters for the request name while only needing to normalize the file name part.

We have some UX ideas on how to enable this, which we share soon. Please standby for more updates.

Related Issues

Related PRs

helloanoop commented 1 month ago

This is being worked upon. PR for reference: https://github.com/usebruno/bruno/pull/3094