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
tests: resolve paths for windows #32
Conversation
5 tests still failing where path.resolve() isn't used yet.
|
hmmm i have no idea... i don't have a windows machine! |
I will look into it |
Okay so I looked into the source code a bit. What's failing is that it should answer with a 404 when the path is absolute. However, I if the path is absolute, I also don't quite get why it should send a 404, does this mean it sends a 404 every time I try to send a file with an absolute path? |
if it's 400, then something is "malformed", i.e. can't be decoded with |
I stepped through it with a debugger, this is not the reason. // path should never be absolute
if (pathIsAbsolute.posix(path) || pathIsAbsolute.win32(path)) {
throw createError(400, 'Malicious Path')
} Called here in send/index.js, line 58, without any try/catch: path = resolvePath(root, path); Which means this error bubbles up to the client with a 400 response. What I don't understand is the desired behaviour. Why should it answer with a 404 when the developer-specified path is absolute? And where is the logic in the code for this? The number "404" doesn't even show up anywhere in the code. I'm confused... |
hmmm i still don't understand what's wrong. :/ |
Just... please explain to me how this feature (should answer with 404 if path is absolute) is supposed to work and I'll submit a PR |
@felixfbecker Would also look into this bug... but I have removed all traces of Windows from my possessions, lol. Anyhow, I'd recommend setting up a Vagrant box or something so you can properly run tests (or to help compare desired functionality vs result on Windows). |
Merge #36 :) |
@jonathanong branch |
i think he fixed it w/ #36 |
#36 merged into koajs:31-windows |
OH |
@felixfbecker do you mind rebasing? or @coderhaoxin want to merge? |
@jonathanong I'll rebase and merge later |
👍 |
I though this was the best approach since you opened this branch to fix the issue. |
merged |
closes #31
@felixfbecker please test!