Skip to content
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

File path slashes not working in Windows #16

Open
randoogle opened this issue Aug 14, 2023 · 4 comments
Open

File path slashes not working in Windows #16

randoogle opened this issue Aug 14, 2023 · 4 comments

Comments

@randoogle
Copy link

Describe the bug
When in Windows, the resulting file path in the Edit Variable preview is missing all folder slashes in Windows.
Example: "C:\Users\someuser\secret_file.env" becomes "C:Userssomeusersecret_file.env"
This causes an error: "ENOENT: no such file or directory, open 'C:Userssomeusersecret_file.env'"

To Reproduce
Steps to reproduce the behavior:

  1. Add environment variable in Base Environment
  2. Tie variable to dotenv file
  3. Note that it outputs the correct value from dotenv file when in Manage Environments
  4. Close Manage Environments
  5. Attempt to use variable in a request (it doesn't seem to matter where)
  6. See the error in preview "ENOENT: no such file or directory, open [file location without slashes]"

Expected behavior
I would expect the Edit Variable to pull in the value of the variable with no error.

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Windows 10 (Windows_NT x64 10.0.19044) & 11
  • Insomnia Version: 2023.5.0
  • Insomnia Build date: 8/14/2023
  • Electron: 25.2.0
  • Node: 18.15.0
  • Node ABI: 116
  • V8: 11.4.183.23-electron.0
  • Architecture: x64

Additional context
I notice that the error is different if you use a dotenv in a Sub Environment. It doesn't bother to output the file path at all.
Also, I've tried the same project and same file in Linux, and this plugin works fine.

@sturose
Copy link

sturose commented Sep 20, 2023

I can confirm, this has impacted me as well on Windows.

@pfefferf
Copy link

Seems that this repo is not maintained anymore.

I have created a fork of this plugin and fixed the issue in the plugin. Unfortunately, it seems that Insomnia has a general issue with escaping. So I changed the type of the .env file parameter to a string, to be able to enter an adapted path with an own escape sequence. For Windows instead of backslashses forward slashes must be used. And these forward slashes must be escaped with a backslash.

Forked plugin: https://www.npmjs.com/package/insomnia-plugin-fpf-dotenv (installation via npm package insomnia-plugin-fpf-dotenv).

@bongosway
Copy link
Owner

@pfefferf Thank you for raising this and for your patience. I haven't been able to respond for a while.
But I can also confirm that this problem is no longer in the latest version (10.1.0)

I will close this issue for now, but happy to look at it again if the problem persists.

@BrainCrumbz
Copy link

Hi

Version: Insomnia 10.1.1
Build date: 24/10/2024
OS: Windows_NT x64 10.0.22631
Electron: 31.4.0
Node: 20.16.0
Node ABI: 125
V8: 12.6.228.30-electron.0
Architecture: x64

Plugin ver.: 1.2.0

we can confirm that this still happens. Just installed this plugin, so please bear with us. What additional info can we provide?

Edit tag dialog, for a variable in base environment:

immagine

Variable used in Auth tab of a folder:

immagine

Edit variable dialog. Actual path is "D:\Temp\.env.development":

immagine

@bongosway bongosway reopened this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants