fix: failing to import insomnia collection when username/password in auth is null (#3293)

* fix: sanitize authentication input
 edgecase where value is null instead of expected empty string

* fix: refactor to be immutable

* Revert "fix: refactor to be immutable"

This reverts commit eec0e51d98.
This commit is contained in:
Jake Owen 2024-10-13 13:25:13 +01:00 committed by GitHub
parent dce96e0f13
commit 2fc79e0e7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,6 +60,7 @@ const addSuffixToDuplicateName = (item, index, allItems) => {
const regexVariable = new RegExp('{{.*?}}', 'g'); const regexVariable = new RegExp('{{.*?}}', 'g');
const normalizeVariables = (value) => { const normalizeVariables = (value) => {
value = value || '';
const variables = value.match(regexVariable) || []; const variables = value.match(regexVariable) || [];
each(variables, (variable) => { each(variables, (variable) => {
value = value.replace(variable, variable.replace('_.', '').replaceAll(' ', '')); value = value.replace(variable, variable.replace('_.', '').replaceAll(' ', ''));