Closed imkarma closed 8 years ago
@imkarma not really sure that it's fixed. because staticDir
might contain Windows path separator.
@konstantinzolotarev now I use "trailpack-hapi": "git+https://github.com/imkarma/trailpack-hapi.git" and its work fine. Becouse if use old code I have
server.route({
method: 'GET',
path: '\static\{filename*}',
....
})
but right syntaxis
server.route({
method: 'GET',
path: '/static/{filename*}',
....
})
it's becouse Windows dir seperator '\' but we must have '/' like on unix os
@scott-wyatt problem not with path. Promlem convert windowc path to string to applay http path. on windows we have \static{filename}, with path.normalize we will have somwthin like this \static\{filename}, but we need /static/{filename*} for http requests http://example.com/static/index.html for example
@imkarma Yep I know. I mean this code:
const staticDir = path.relative(app.config.main.paths.root, app.config.main.paths.www)
Could contain path something\some
if
app.config.main.paths.root = 'something'
app.config.main.paths.www = 'some'
And your fix wouldn't work because it will include wrong staticDir
@konstantinzolotarev Now i understend what you mean and add fix, I hope :)
@konstantinzolotarev sorry can you look to this pull request again I add RegEx and now it must be cool :) Or geve feedback and i try rewritte if needed
On windows was error "Invalid path". Becouse plugin take window seperator "\". Now its fine :)