solid-server 5.8.0 → 5.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ldp.js CHANGED
@@ -459,7 +459,7 @@ class LDP {
459
459
  ({ path, contentType } = await this.resourceMapper.mapUrlToFile({ url: options, searchIndex }))
460
460
  stats = await this.stat(path)
461
461
  } catch (err) {
462
- throw error(404, 'Can\'t find file requested: ' + options)
462
+ throw error(err.status || 500, err.message)
463
463
  }
464
464
 
465
465
  // Just return, since resource exists
@@ -125,7 +125,7 @@ class ResourceMapper {
125
125
 
126
126
  // Find a file with the same name (minus the dollar extension)
127
127
  let match = ''
128
- if (match === '') { // always true to keep indentation
128
+ try {
129
129
  const files = await this._readdir(folder)
130
130
  // Search for files with the same name (disregarding a dollar extension)
131
131
  if (!isFolder) {
@@ -134,13 +134,15 @@ class ResourceMapper {
134
134
  } else if (searchIndex && files.includes(this._indexFilename)) {
135
135
  match = this._indexFilename
136
136
  }
137
+ } catch (err) {
138
+ throw new HTTPError(404, `${filePath} Resource not found`)
137
139
  }
138
140
  // Error if no match was found (unless URL ends with '/', then fall back to the folder)
139
141
  if (match === undefined) {
140
142
  if (isIndex) {
141
143
  match = ''
142
144
  } else {
143
- throw new HTTPError(404, `Resource not found: ${pathname}`)
145
+ throw new HTTPError(404, `${pathname} Resource not found`)
144
146
  }
145
147
  }
146
148
  path = `${folder}${match}`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-server",
3
3
  "description": "Solid server on top of the file-system",
4
- "version": "5.8.0",
4
+ "version": "5.8.1",
5
5
  "author": {
6
6
  "name": "Tim Berners-Lee",
7
7
  "email": "timbl@w3.org"