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

Using ".." in file path parameter of Static Middleware call #298

Closed
joefru opened this Issue Jun 18, 2011 · 6 comments

Comments

Projects
None yet
4 participants
@joefru

joefru commented Jun 18, 2011

I have my Express config nested in a folder like this: ./lib/config/config.js. When I try to do this:

app.use(express.static(__dirname + "/../../public"));

I get a Forbidden error for anything in the public folder.

When I move that use statement to a file in the root folder of my app and call it like this:

app.use(express.static(__dirname + "/public"));

it works perfectly fine. It used to work both ways before I updated Connect to 1.4.5 from 1.4.1.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Jun 18, 2011

Contributor

For now you can do (in your nested config):

app.use(express.static(require('path').resolve(__dirname + "/../../public")));
Contributor

rauchg commented Jun 18, 2011

For now you can do (in your nested config):

app.use(express.static(require('path').resolve(__dirname + "/../../public")));
@joefru

This comment has been minimized.

Show comment
Hide comment
@joefru

joefru Jun 18, 2011

Thanks, guille. Worked like a charm.

joefru commented Jun 18, 2011

Thanks, guille. Worked like a charm.

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Jun 18, 2011

Member

fixed

Member

tj commented Jun 18, 2011

fixed

@tj tj closed this Jun 18, 2011

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Jun 18, 2011

Contributor

Was this a 4am fix TJ?

Contributor

rauchg commented Jun 18, 2011

Was this a 4am fix TJ?

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Jun 18, 2011

Member

my sleeping skills are amazing, among the best, perhaps even better than mercedes

Member

tj commented Jun 18, 2011

my sleeping skills are amazing, among the best, perhaps even better than mercedes

@n2liquid

This comment has been minimized.

Show comment
Hide comment
@n2liquid

n2liquid Nov 7, 2013

TJ, why don't you tell us more about that rm -rf pull request...

n2liquid commented Nov 7, 2013

TJ, why don't you tell us more about that rm -rf pull request...

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