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

Relative certificate path resolving not working #190

Closed
redcoreit opened this issue Apr 13, 2018 · 3 comments
Closed

Relative certificate path resolving not working #190

redcoreit opened this issue Apr 13, 2018 · 3 comments
Labels

Comments

@redcoreit
Copy link

redcoreit commented Apr 13, 2018

  • VSCode Version: 1.22.1
  • OS Version: Win10 1709 OS Build 16299.371
  • REST Client Version: 0.18.1 (2018/3/30)

Steps to Reproduce:

  1. Setup a workspace folder
  2. Put a .rest file with some valid data (irrelevant)
  3. Put the following config to the workspace file:
"rest-client.certificates": {
	"test1.azurewebsites.net": {
		"pfx": "./Certificates/ABC.pfx",
		"passphrase": "F1234"
	}
}
  1. Send the request

Reslut:

Certificate path ./Certificates/ABC.pfx of pfx doesn't exist, please make sure it exists.

Possible bug in httpClient.ts file (debugged values added to the code):

...
        // the path should be relative path
        let rootPath = getWorkspaceRootPath(); //Debug: "file:///c%3A/var/tmp/bla-api-test/"
        let absolutePath = '';
        if (rootPath) {
            absolutePath = path.join(rootPath, absoluteOrRelativePath); //Debug: "file:\c%3A\var\tmp\bla-api-test\ABC.pax"
            if (fs.existsSync(absolutePath)) { //Debug: false
                return absolutePath;
            } else {
                window.showWarningMessage(`Certificate path ${absoluteOrRelativePath} of ${certName} doesn't exist, please make sure it exists.`);
                return;
            }
        }
...

showWarningMessage will be called

@Huachao
Copy link
Owner

Huachao commented Apr 14, 2018

@redcoreit nice catch, guy, I have fixed it and will publish this fix in next release. Sorry for the inconvenience.

@Huachao Huachao closed this as completed Apr 14, 2018
@Huachao
Copy link
Owner

Huachao commented Apr 17, 2018

@redcoreit you can verify this fix in latest version 0.18.2, thanks in advance.

@redcoreit
Copy link
Author

Perfect, thank you! Keep up the good work, awesome extension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants