Skip to content

Commit 110a4a3

Browse files
authored
Merge pull request #1156 from solid/fix/#1120
Fix/#1120
2 parents ef52610 + 5e0748e commit 110a4a3

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ $ solid start
104104
Otherwise, if you want to use flags, this would be the equivalent
105105

106106
```bash
107-
$ solid start --multiuser --port 8443 --cert /path/to/cert --key /path/to/key --root ./data
107+
$ solid start --multiuser --port 8443 --ssl-cert /path/to/cert --ssl-key /path/to/key --root ./data
108108
```
109109

110110
Your users will have a dedicated folder under `./data` at `./data/<username>.<yourdomain.tld>`. Also, your root domain's website will be in `./data/<yourdomain.tld>`. New users can create accounts on `/api/accounts/new` and create new certificates on `/api/accounts/cert`. An easy-to-use sign-up tool is found on `/api/accounts`.

lib/handlers/get.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ async function handler (req, res, next) {
3939
'path': path,
4040
'includeBody': includeBody,
4141
'possibleRDFType': possibleRDFType,
42-
'range': req.headers.range
42+
'range': req.headers.range,
43+
'contentType': req.headers.accept
4344
}
4445

4546
let ret

lib/ldp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ class LDP {
329329
async get (options, searchIndex = true) {
330330
let path, contentType, stats
331331
try {
332-
({ path, contentType } = await this.resourceMapper.mapUrlToFile({ url: options, searchIndex }))
332+
({ path, contentType } = await this.resourceMapper.mapUrlToFile({
333+
url: options, contentType: options.contentType, searchIndex
334+
}))
333335
stats = await this.stat(path)
334336
} catch (err) {
335337
throw error(404, 'Can\'t find file requested: ' + options)

lib/resource-mapper.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class ResourceMapper {
5555
}
5656
fullPath += this._indexFilename
5757
}
58-
5958
// Create the path for a new file
6059
if (createIfNotExists) {
6160
path = fullPath
@@ -71,6 +70,14 @@ class ResourceMapper {
7170

7271
// Find a file with the same name (minus the dollar extension)
7372
let match = searchIndex ? await this._getMatchingFile(folder, filename, isIndex) : ''
73+
// Do not match with html if the content type won't allow it
74+
if (
75+
contentType &&
76+
!(contentType.includes('text/html') || contentType.includes('*/*')) &&
77+
match === this._indexFilename
78+
) {
79+
match = ''
80+
}
7481
if (match === undefined) {
7582
// Error if no match was found,
7683
// unless the URL ends with a '/',

0 commit comments

Comments
 (0)