Fix: File path fails when used in env vars on Windows [INS-4742] #8221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix
When we do a double-escape of the
\
slash ontag-editor.tsx
it solves the issue.It seems before we were sanitizing the tag in different ways, and that didn't work, but it's unclear how it may have worked years ago. For now this change seems to do the trick
Explored some alternatives, but going down the path of JSON.stringify'ing the argument elsewhere, or trying to sanitize it elsewhere, becomes a trap quickly and doesn't fully work.
Investigation details here
When using File template tags as value for environment variables in the JSON / non-table view of the Environment Editor, the file path gets stored with a bad path on the environment.
\\\\
to\\
\\
- which then magically dissappears when attempting to use the Env variable in a request, so a string likeC:\\Users\\filipe\\Desktop\\test.txt
ends up asC:\UsersfilipeDesktoptest.txt
AppData\Local\insomnia\app-10.2.0
path to the full bad path.Closes INS-4742
Closes #5754