Skip to content

Commit 218b36a

Browse files
committed
Removing hardcoded string of .acl-suffix
1 parent b1562ac commit 218b36a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/create-app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ function createApp (argv = {}) {
4848
rootUrl: argv.serverUri,
4949
rootPath: path.resolve(argv.root || process.cwd()),
5050
includeHost: argv.multiuser,
51-
defaultContentType: argv.defaultContentType
51+
defaultContentType: argv.defaultContentType,
52+
fileSuffixes: {
53+
acl: argv.suffixAcl || '.acl',
54+
meta: argv.suffixMeta || '.meta'
55+
}
5256
})
5357

5458
const configPath = config.initConfigDir(argv)

lib/resource-mapper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class ResourceMapper {
1515
includeHost = false,
1616
defaultContentType = 'application/octet-stream',
1717
indexFilename = 'index',
18-
overrideTypes = { acl: 'text/turtle', meta: 'text/turtle' }
18+
overrideTypes = { acl: 'text/turtle', meta: 'text/turtle' },
19+
fileSuffixes = { acl: '.acl', meta: '.meta' }
1920
}) {
2021
this._rootUrl = this._removeTrailingSlash(rootUrl)
2122
this._rootPath = this._removeTrailingSlash(rootPath)
@@ -24,6 +25,7 @@ class ResourceMapper {
2425
this._defaultContentType = defaultContentType
2526
this._indexFilename = indexFilename
2627
this._types = { ...types, ...overrideTypes }
28+
this._suffixes = fileSuffixes
2729

2830
// If the host needs to be replaced on every call, pre-split the root URL
2931
if (includeHost) {
@@ -93,7 +95,7 @@ class ResourceMapper {
9395

9496
// Find a file with the same name (minus the dollar extension)
9597
return (files.find(f => this._removeDollarExtension(f) === filename ||
96-
(isIndex && f.startsWith(this._indexFilename + '.') && !f.endsWith('.acl'))))
98+
(isIndex && f.startsWith(this._indexFilename + '.') && !f.endsWith(this._suffixes.acl))))
9799
}
98100

99101
async getRepresentationUrlForResource (resourceUrl) {

0 commit comments

Comments
 (0)