Skip to content

Commit fadf2cc

Browse files
committed
Rename getBasePath into getBaseFilePath.
1 parent 226751c commit fadf2cc

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

lib/handlers/get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function hasReadPermissions (file, req, res, callback) {
204204
return callback(true)
205205
}
206206

207-
const root = ldp.resourceMapper.getBasePath(req.hostname)
207+
const root = ldp.resourceMapper.getBaseFilePath(req.hostname)
208208
const relativePath = '/' + _path.relative(root, file)
209209
res.locals.path = relativePath
210210
allow('Read')(req, res, err => callback(!err))

lib/models/account-manager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ class AccountManager {
130130
* @return {string}
131131
*/
132132
accountDirFor (accountName) {
133-
return this.store.resourceMapper.getBasePath(url.parse(this.accountUriFor(accountName)).hostname)
133+
const { hostname } = url.parse(this.accountUriFor(accountName))
134+
return this.store.resourceMapper.getBaseFilePath(hostname)
134135
}
135136

136137
/**

lib/resource-mapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class ResourceMapper {
129129
}
130130

131131
// Gets the base file path for the given hostname
132-
getBasePath (hostname) {
132+
getBaseFilePath (hostname) {
133133
return !this._includeHost ? this._rootPath : `${this._rootPath}/${hostname}`
134134
}
135135

@@ -148,7 +148,7 @@ class ResourceMapper {
148148
// Determine the full file path corresponding to a URL
149149
_getFilePath (url) {
150150
const { pathname, hostname } = this._parseUrl(url)
151-
const fullFilePath = decodeURIComponent(`${this.getBasePath(hostname)}${pathname}`)
151+
const fullFilePath = `${this.getBaseFilePath(hostname)}${decodeURIComponent(pathname)}`
152152
if (fullFilePath.indexOf('/..') >= 0) {
153153
throw new Error('Disallowed /.. segment in URL')
154154
}

lib/server-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function ensureDirCopyExists (fromDir, toDir) {
6060
*/
6161
async function ensureWelcomePage (argv) {
6262
const { resourceMapper, templates, server, host } = argv
63-
const serverRootDir = resourceMapper.getBasePath(host.hostname)
63+
const serverRootDir = resourceMapper.getBaseFilePath(host.hostname)
6464
const existingIndexPage = path.join(serverRootDir, 'index.html')
6565
const packageData = require('../package.json')
6666

0 commit comments

Comments
 (0)