-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: Fix name validation consistency #349
base: main
Are you sure you want to change the base?
fix: Fix name validation consistency #349
Conversation
f13d845
to
249f318
Compare
Somewhat related to #365 |
I updated my PR to allow all special chars in request names, this should resolve #388, #189 & #174. I also updated the name length validation to 250 characters, 256 characters is the windows length limit, so 250 leaves some space for the file extension, this should resolve: #163, #378 & #501. Example: 2023-10-06_21-49-51.mp4Example with old project, created with the current bruno version: 2023-10-06_21-57-30.mp4There might still some things to fix, I look into that tomorrow |
Hey @helloanoop, this PR should be ready to be reviewed and merged now. After this, I can start working on updating the Postman/Insomnia importer to close #365 |
…me/delete needs to be run only on windows" This reverts commit fcc12fb.
I update the sanitization Regex to match the directory regex. I noticed that it would be very hard for a language like Japanese to use Bruno with the other regex, because |
I think /^(?!CON|PRN|AUX|NUL|COM\d|LPT\d|^ |^\-)[\w\-\. {}\(\)\[\]\!]+[^\. ]$/ |
Hey @nomorsug, sorry for the confusion, but the Regex in my initial comment is not up-to-date anymore. With the newest changes, you can use any character in the request name. To make sure filenames are valid, characters like |
@Its-treason was talking about the folder names, this regex to be specific packages/bruno-app/src/utils/common/regex.js to allow for curly braces |
@nomorsug Sorry, I forget about the directory regex. I updated it to match the request sanitization regex:
This now disallows only the problematic special characters like Thank you for pointing that out! |
@@ -17,8 +17,8 @@ const CreateEnvironment = ({ collection, onClose }) => { | |||
}, | |||
validationSchema: Yup.object({ | |||
name: Yup.string() | |||
.min(1, 'must be at least 1 character') | |||
.max(50, 'must be 50 characters or less') | |||
.min(1, 'must be atleast 1 characters') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the intention of this change? The previous wording was grammatically correct.
e687fec
to
8e68b8f
Compare
@helloanoop can we get this PR reviewed/merged? It will dramatically improve file handling for environments. |
@helloanoop any chance of this getting merged soon? Postman imports are still impacted by the incorrect validation and v1.0 has been released |
That would be very nice. I'm also struggeling with the fact that i cannot use "/" in my request names. |
Really needing this to get into Bruno to make it more usable (also using / in request names) |
Not sure when, or if this will ever be merged into Bruno. For now you can use my fork: https://github.com/Its-treason/bruno/releases/tag/nightly it's compatible with mainline Bruno and currently used by our Team, because it includes some performance improvements. |
Please fix this. This stopping me from switching to bruno. |
Showstopper for my team too. @helloanoop |
I also wanted to switch to bruno, so I started with a sample request (/products), renamed the request (/products/id), and I get error. (macOS, latest version). This is a critical bug in my opinion and it's a blocker for me to switch to this app. |
For those tired of waiting for this and sick of Insomnia... I found another lightweight (based on electron) client here: |
Or checkout my fork: https://github.com/Its-treason/bruno/releases/tag/nightly it includes this and many more fixes while being fully compatible with Bruno. |
Hey everyone! Apologies for such a late update on this. In hindsight, we should have prioritised and delivered a solution for this earlier. The core solution in this PR is around normalizing the filename and replacing them with const sanitizeFilename = (name) => {
return name.replace(/[<>:"/\\|?*\x00-\x1F]/g, '_');
}; We are working on an improvisation on top of this PR that allows you to have more control over the filename under which the request data is stored. Here is the PR - #3094 tracking this work. Our goal is to have this refined and delivered within the next two weeks. Thanks for your patience. request-folder-names.mp4 |
@helloanoop @lohxt1 any updates or timeline for this? |
I was reporting this bug (like accepting a |
Edit: Updated the PR, please read next comment
With this PR I want to fix validation problems when creating folder, requests or environments. All names now use a validation regex:
This regex ensures various rules when naming files on the file system, so users don't run into weird problems:
a-z
,A-Z
,0-9
,_
,-
,.
,(
,)
,[
,]
and(
,)
,[
,]
,.
You can test this regex on regexr: https://regexr.com/7l552
For reference for all limitations, I used:
I also removed the
is-valid-path
/isValidPathname
check from the collection creation as this check was very strict and would not pass with names containing common special characters and a failed checked would only fail with an “An error occurred” toast. This should resolve #174For the future we should make it, so all characters are allowed in the Request/Folder name, but the special characters are only saved in the .bru file meta and the file name is automatically stripped from special characters. This should then resolve: #189 & #388. But will take some time to fix as it is more complicated.