Skip to content

Commit e857626

Browse files
committed
Making resourceMapper.getFullPath public
1 parent 4a6babf commit e857626

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

lib/handlers/get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async function globHandler (req, res, next) {
142142
nodir: true
143143
}
144144

145-
const filename = ldp.getFullPath(req)
145+
const filename = ldp.resourceMapper.getFullPath(req)
146146
glob(filename, globOptions, function (err, matches) {
147147
if (err || matches.length === 0) {
148148
debugGlob('No files matching the pattern')

lib/handlers/put.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function putStream (req, res, next, stream = req) {
3636
async function putAcl (req, res, next) {
3737
const ldp = req.app.locals.ldp
3838
const contentType = req.get('content-type')
39-
const path = ldp.getFullPath(req)
39+
const path = ldp.resourceMapper.getFullPath(req)
4040
const requestUri = await ldp.resourceMapper.resolveUrl(req.hostname, path)
4141
if (ldp.isValidRdf(req.body, requestUri, contentType)) {
4242
const stream = stringToStream(req.body)

lib/ldp.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,6 @@ class LDP {
463463
return ensureNotExists(this, path.join(containerURI, filename))
464464
}
465465

466-
getFullPath (req) {
467-
return this.resourceMapper._getFullPath(req)
468-
}
469-
470466
static mimeTypeIsRdf (mimeType) {
471467
return RDF_MIME_TYPES.has(mimeType)
472468
}

lib/resource-mapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ResourceMapper {
4242
// When the URL ends with a '/', then files with the prefix 'index.' will be matched,
4343
// such as 'index.html' and 'index.ttl', unless searchIndex is false.
4444
async mapUrlToFile ({ url, contentType, createIfNotExists, searchIndex = true }) {
45-
let fullPath = this._getFullPath(url)
45+
let fullPath = this.getFullPath(url)
4646
let isIndex = searchIndex && fullPath.endsWith('/')
4747
let path
4848

@@ -111,7 +111,7 @@ class ResourceMapper {
111111
}
112112

113113
// Determine the full file path corresponding to a URL
114-
_getFullPath (url) {
114+
getFullPath (url) {
115115
const { pathname, hostname } = this._parseUrl(url)
116116
const fullPath = decodeURIComponent(`${this.getBasePath(hostname)}${pathname}`)
117117
if (fullPath.indexOf('/..') >= 0) {

0 commit comments

Comments
 (0)