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

Return redirection for symlinks #87

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

piranna
Copy link
Contributor

@piranna piranna commented Dec 8, 2015

This fixes issue #86

var deprecate = require('depd')('send')
var destroy = require('destroy')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo all these changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just put the requires sorted alphabetically and grouped by build-ins, third-parties and local modules, as it's usually accepted in the Node.js community. Also I've made the requires style uniform, instead of some of them using its own var statement and others a common one, and some requires that were hidden between the variables declarations. Do you still want these clean-up changes to be undone?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you still want these clean-up changes to be undone?

Yes. It is extremely important to us that git blame stays intact, thus why there is a mixed style.

@dougwilson
Copy link
Contributor

Hi! Thanks for the pull request! Please undo all the style changes, mainly because they are unwelcome (we weren't asking for style changes) and it makes it really hard for me to understand what changed from looking at the diff.

Also, please add documentation and tests for the new feature so we can accept it :)

index.js Outdated

function responseStatus(res, code, msg)
{
if(msg == null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please match existing styles, for example the bracket style really stands out as misplaced.

@dougwilson
Copy link
Contributor

Hi! Your original suggested I agreeded to was "Add an option to show the symbolic links as 301 redirections to the file location instead of return the file content.". I don't see an option to enable the feature. If this always enabled? If not, what is the option? We need an option to enable/disable this feature. If you want it accepted any time soon, you should probably default it to disabled so it's backwards compatible.

@dougwilson
Copy link
Contributor

Oh, sorry, looks like you added a test from when I looked at it hours ago, haha. Please try to add more tests, including non happy paths. A new feature should have many tests, not just one, as there are probably edge cases you need to test for, for example, what about folder junctions vs folder symlinks? I wouldn't expect a junction to redirect, is that the case with these changes or no?

@piranna
Copy link
Contributor Author

piranna commented Dec 9, 2015

I've just done your suggestions :-)

@dougwilson dougwilson self-assigned this Dec 10, 2015
@dougwilson dougwilson added the pr label Dec 10, 2015
index.js Outdated
if (listenerCount(this, 'directory') !== 0) {
this.emit('directory')
return
}

if (this.hasTrailingSlash()) {
this.error(403)
return
return this.error(403)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be returning undefined, rather than the event emitter instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should have missed it before. Anyway it doesn't matter if it returns the event-emitter or undefined as far as it's not being used, and in fact I've seen in several places that this is the recomended way to do it. Anyway, I've already fixed it.

@piranna
Copy link
Contributor Author

piranna commented Jan 21, 2016

I've just set 403 error by default if destination is outside files root.

@piranna
Copy link
Contributor Author

piranna commented May 2, 2016

Any update on this?

@dougwilson
Copy link
Contributor

Hi @piranna, sorry, I have not taken a look since you changed the pull request. Can you at least take a look and fix the failing tests so the pull request passes the test while I take a look at the new changes? Also note that one of the tests is marked as "double callback!" with your changes, so even though that's not causing a failure, you'll need to get that fixed as well.

@piranna
Copy link
Contributor Author

piranna commented Aug 13, 2016

Tests are failling to some unrelated test I can't be able to identify what's the source of the problem ("should return 500 on error when reading file"). Could you be able to take a look so this could be merged?

@piranna
Copy link
Contributor Author

piranna commented Aug 13, 2016

The problem that's giving is about the callback being called twice, probably due to the nextTick() call in the test.

@dougwilson
Copy link
Contributor

There are still a lot of failing tests and you haven't fixed the double callback, either. In addition, it looks like when you merged, you accidentally reverted code, including a security fix. Please fix all that up and ping me and I'll come back and take a look :)!

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

Successfully merging this pull request may close these issues.

None yet

2 participants