Skip to content

Commit ca19d16

Browse files
authored
Merge pull request #1088 from solid/fix/root-relative-path
Fixed so that relative paths are allowed in root param
2 parents 79c2741 + 500a78a commit ca19d16

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

bin/lib/start.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const options = require('./options')
44
const fs = require('fs')
5+
const path = require('path')
56
const { loadConfig } = require('./cli-utils')
67
const { red, bold } = require('colorette')
78

@@ -84,10 +85,7 @@ function bin (argv, server) {
8485

8586
// Overwrite root .acl if owner is specified
8687
if (argv.owner) {
87-
let rootPath = argv.root
88-
if (!rootPath) {
89-
rootPath = process.cwd()
90-
}
88+
let rootPath = path.resolve(argv.root || process.cwd())
9189
if (!(rootPath.endsWith('/'))) {
9290
rootPath += '/'
9391
}

lib/create-app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function createApp (argv = {}) {
4545

4646
argv.resourceMapper = new ResourceMapper({
4747
rootUrl: argv.serverUri,
48-
rootPath: argv.root || process.cwd(),
48+
rootPath: path.resolve(argv.root || process.cwd()),
4949
includeHost: argv.multiuser,
5050
defaultContentType: argv.defaultContentType
5151
})
@@ -64,6 +64,7 @@ function createApp (argv = {}) {
6464

6565
// Serve the public 'common' directory (for shared CSS files, etc)
6666
app.use('/common', express.static(path.join(__dirname, '../common')))
67+
routeResolvedFile(app, '/common/js/', 'mashlib/dist/mashlib.js')
6768
routeResolvedFile(app, '/common/js/', 'mashlib/dist/mashlib.min.js')
6869
routeResolvedFile(app, '/common/js/', 'mashlib/dist/mashlib.min.js.map')
6970
routeResolvedFile(app, '/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js')

test/integration/params-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('LDNODE params', function () {
5656
var server = supertest(ldp)
5757

5858
it('should fallback on current working directory', function () {
59-
assert.equal(ldp.locals.ldp.resourceMapper._rootPath, './test/resources')
59+
assert.equal(ldp.locals.ldp.resourceMapper._rootPath, path.resolve('./test/resources'))
6060
})
6161

6262
it('should find resource in correct path', function (done) {

0 commit comments

Comments
 (0)