Skip to content

Commit b1562ac

Browse files
committed
Removes acl files from list of files to match when mapping url to file
Should fix #1104
1 parent 217e8e3 commit b1562ac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/resource-mapper.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ class ResourceMapper {
6868
// Read all files in the corresponding folder
6969
const filename = fullPath.substr(fullPath.lastIndexOf('/') + 1)
7070
const folder = fullPath.substr(0, fullPath.length - filename.length)
71-
const files = await this._readdir(folder)
7271

7372
// Find a file with the same name (minus the dollar extension)
74-
let match = !searchIndex ? '' : (files.find(f => this._removeDollarExtension(f) === filename ||
75-
(isIndex && f.startsWith(this._indexFilename + '.'))))
73+
let match = searchIndex ? await this._getMatchingFile(folder, filename, isIndex) : ''
7674
if (match === undefined) {
7775
// Error if no match was found,
7876
// unless the URL ends with a '/',
@@ -90,6 +88,14 @@ class ResourceMapper {
9088
return { path, contentType: contentType || this._defaultContentType }
9189
}
9290

91+
async _getMatchingFile (folder, filename, isIndex) {
92+
const files = await this._readdir(folder)
93+
94+
// Find a file with the same name (minus the dollar extension)
95+
return (files.find(f => this._removeDollarExtension(f) === filename ||
96+
(isIndex && f.startsWith(this._indexFilename + '.') && !f.endsWith('.acl'))))
97+
}
98+
9399
async getRepresentationUrlForResource (resourceUrl) {
94100
let fullPath = this.getFullPath(resourceUrl)
95101
let isIndex = fullPath.endsWith('/')

0 commit comments

Comments
 (0)