diff --git a/lib/handlers/put.js b/lib/handlers/put.js index 168278a46..4979dc9c5 100644 --- a/lib/handlers/put.js +++ b/lib/handlers/put.js @@ -11,7 +11,7 @@ async function handler (req, res, next) { res.header('MS-Author-Via', 'SPARQL') const contentType = req.get('content-type') - // check if a folder or resource with same name exists + // check whether a folder or resource with same name exists try { const ldp = req.app.locals.ldp await ldp.checkItemName(req) diff --git a/lib/ldp.js b/lib/ldp.js index c24cc12b0..b785d6e18 100644 --- a/lib/ldp.js +++ b/lib/ldp.js @@ -158,7 +158,7 @@ class LDP { extension = '' } - // allways return a valid URL. + // always return a valid URL. const resourceUrl = await ldp.getAvailableUrl(hostname, containerPath, { slug, extension, container }) debug.handlers('POST -- Will create at: ' + resourceUrl) @@ -327,7 +327,7 @@ class LDP { } catch (err) { } } - // check if a document (or container) has the same name than a document (or container) + // check whether a document (or container) has the same name as another document (or container) async checkItemName (url) { let testName, testPath const { hostname, pathname } = this.resourceMapper._parseUrl(url) // (url.url || url) @@ -585,13 +585,13 @@ class LDP { let itemName = slug.endsWith(extension) || slug.endsWith(this.suffixAcl) || slug.endsWith(this.suffixMeta) ? slug : slug + extension try { - // check resource exists + // check whether resource exists const context = container ? '/' : '' await this.resourceMapper.mapUrlToFile({ url: (requestUrl + itemName + context) }) itemName = `${uuid.v1()}-${itemName}` } catch (e) { try { - // check resource with same name exists + // check whether resource with same name exists const context = !container ? '/' : '' await this.resourceMapper.mapUrlToFile({ url: (requestUrl + itemName + context) }) itemName = `${uuid.v1()}-${itemName}`