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(http/file_server): use platform specific resolve #3424

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

Chocobo1
Copy link
Contributor

@Chocobo1 Chocobo1 commented Jun 4, 2023

On Windows, running posix.resolve("C:\\Users\\abc") within C:\Users\abc\Desktop\folderabc would resolve to
C:\Users\abc\Desktop\folderabc/C:\Users\abc which is not expected.

@Chocobo1 Chocobo1 requested a review from kt3k as a code owner June 4, 2023 10:21
@CLAassistant
Copy link

CLAassistant commented Jun 4, 2023

CLA assistant check
All committers have signed the CLA.

@kt3k
Copy link
Member

kt3k commented Jun 5, 2023

Can you write a test case for this? ignore: Deno.build.os !== "windows" option in test definition would probably be useful

@Chocobo1
Copy link
Contributor Author

Chocobo1 commented Jun 5, 2023

Can you write a test case for this?

Sorry, I'm not sure what kind of test would do. Any ideas?

@kt3k
Copy link
Member

kt3k commented Jun 5, 2023

Start the server like this line:

const fileServer = new Deno.Command(Deno.execPath(), {

With the first argument as a path starting with C:/. And then check a correct file is served, and stop the server.

On Windows, running `posix.resolve("C:\\Users\\abc")` within
`C:\Users\abc\Desktop\folderabc` would resolve to
`C:\Users\abc\Desktop\folderabc/C:\Users\abc` which is not expected.
@Chocobo1
Copy link
Contributor Author

Chocobo1 commented Jun 5, 2023

I've added a test, please take a look.

Copy link
Member

@kt3k kt3k 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 adding a test case! LGTM

@kt3k kt3k merged commit bdfacdd into denoland:main Jun 6, 2023
8 checks passed
@Chocobo1 Chocobo1 deleted the httpServer branch June 6, 2023 05:01
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

3 participants