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

fix: judge file format by server's content-type header #125

Merged
merged 4 commits into from Feb 4, 2022

Conversation

qiu8310
Copy link
Contributor

@qiu8310 qiu8310 commented Feb 3, 2022

No description provided.

@qiu8310
Copy link
Contributor Author

qiu8310 commented Feb 3, 2022

related to #106

@qiu8310
Copy link
Contributor Author

qiu8310 commented Feb 3, 2022

There is another problem when running yarn test in sample directory, can't figure out why:

The first runTest is success, but second failed.

image

@qiu8310
Copy link
Contributor Author

qiu8310 commented Feb 3, 2022

It looks like the error is caused by the warning:

WARNING: IPC handle "/Users/Mora/Workspace/mora/example-ts-vscode-extension/vscode-test/sample/.vscode-test/user-data/1.63.2-main.sock" is longer than 103 chars, try a shorter --user-data-dir

switch the project to a shorter folder, all tests is passed.

Comment on lines +89 to +90
const contentType = download.headers['content-type'];
const isZip = contentType ? contentType === 'application/zip' : url.endsWith('.zip');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const contentType = download.headers['content-type'];
const isZip = contentType ? contentType === 'application/zip' : url.endsWith('.zip');
const isZip = download.headers['content-type'] === 'application/zip' ?? url.endsWith('.zip');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

download.headers['content-type'] === 'application/zip' is always true or false, so url.endsWith('.zip') will never be reached.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. Nevermind then 👍

Copy link
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! Not sure why it didn't cause issues on my machine. One small cleanup comment

qiu8310 and others added 2 commits February 4, 2022 18:08
Co-authored-by: Connor Peet <connor@peet.io>
@connor4312 connor4312 merged commit e83d77e into microsoft:main Feb 4, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants