Trim whitespace from tokens before tokenising#9847
Trim whitespace from tokens before tokenising#9847mintsoft wants to merge 1 commit intoopnsense:masterfrom
Conversation
…de it will automatically put it into a token box and then error on save The only way to fix that is to paste into an editor, fix the data and then copy-paste back into opnsense. This should trim before tokenizing the data
|
It's a good idea on the surface, but it doesn't fix much and leads to other problems. My favourite example is that the code used to trim a password for no good reasons. It's asking for trouble later than just making sure the pasted data is clean. Cheers, |
|
Hmm, you make a good point regarding the password and I understand your concerns however my reading of the code is that this won't affect that anyway, it's only in the situation where the tokenizer is hooked into the list (which seems to be multi-select only). WRT to significance, I honestly couldn't disagree more strongly. This is an absolutely infuriating experience for any experienced person using opnsense. It's a super common problem to have when you're setting up VPNs to copy and paste out of browsers which frequently will crowbar whitespace before and after values and there is no way to resolve it in-ui because the tokenizer kicks-in before you're able to fix it. An alternative place to do this (which is more targeted, https://github.com/opnsense/core/pull/9847/changes#diff-31373581f35eaa592e76f126a2d240ffdd432a076ec95cb5d8ae1f047716edceR321) would be in the last step when it wraps the values in the |
Previously if you pasted an IP or similar in whitespace on either side it will automatically put it into a token box and then error on save.
The only way to fix that is to paste into an editor, fix the data and then copy-paste back into opnsense. This should trim before tokenizing the data
Fixes: #9438