-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issues #1120 #1256 from NSS5.1.6 ressource-mapper #1282
Conversation
@RubenVerborgh I can try to suppress the my github in between. What shall I do with my PR : wait until master succeed tests or represent it so you can approve it ? |
OK, thx, will need to involve the NSS team then. |
This takes back PR #1280 after passing tests on clean master. The fix works on NSS multiuser under docker and solid-ide I join tests result on my server git and node with completely different errors (I suppose related to my server port usage)
=============================== Coverage summary ===============================
|
I have redone tests on my server for last NSS4.4.2 and NSSv5.1.1, v5.1.4, v5.1.6 and my PR.
As a conclusion The actual NSSv5.1.6 version has stopped a lot of developers in their work. |
I'd like to add a comment on a process that could be introduced to upgarde versions :
If preferred step 1. and 2. couId be in only one step.The main purpose being a validation process on step 2. |
@bourgeoa as discussed on the phone, I'll have a look on Monday! |
@michielbdejong
for information I filled an issue # 94 on solid-UI on a nasty bug that allow to delete .acl from /public (and you cannot recreate it) and worse from /(root) (you loose access to your pod). |
I pushed the |
Great, I'll have a look, maybe I can find time tonight, otherwise I'll do it tomorrow. |
@bourgeoa I had a look as promised, and must say this whole situation feels way too scary to touch without refactoring the resource-mapper to split out its different functions:
What further complicates this is that there seem to be three competing PRs open:
I wouldn't know which one to pick, or where to start to even review your PR with confidence, sorry! The last time we touched the resource mapper it took us several weeks to recover from the fallout so I want to be conservative here. As I said, please start testing your code against https://github.com/inrupt/pod-server which is the rewrite of NSS in TypeScript, and which already has a much higher compliance level on https://github.com/solid/test-suite. Sorry I couldn't be of more help to you - I did try! |
lib/resource-mapper.js
Outdated
// create a new file | ||
if (!(!searchIndex && isFolder)) { | ||
// Append index filename if needed | ||
if (searchIndex && isFolder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sequence of those two if
conditions is weird; we can do better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already had a discussion about that in PR #1280 that begun this PR #1282
I initially proposed :
// create a new container if (!searchIndex && isFolder) { // else create a new resource } else { if (searchIndex && isFolder) {
for me it was clearer but you tell me you did not like void if statement.
It was for me the clearest way. The logic being explicit.
Would you prefer this :
// create a new container if (!searchIndex && isFolder) { return { path } // (do I need the {} around path) // else create a new resource } if (searchIndex && isFolder) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I might have not expressed myself clearly.
What I mean is that
if (!(!searchIndex && isFolder)) {
if (searchIndex && isFolder) {
is equivalent to
if (searchIndex !! !isFolder) {
if (isFolder) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An other proposal will be : (symbolic code)
// create a fileIndex
if (searchIndex && isFolder) -- > path += this.fileIndex and check contentType or throw error
// if create a resource check extension
if (!isFolder) --> check extension against contentType as actually
as before (create a folder will be implicit), then
return { path, contentType : contentType || this._defaultContentType }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fine with me. Just not the repeated conditions.
Those listed are actually already split out, with the exception of the second one (because that is content negotiation and does not belong in the ResourceMapper, which is just an implementation of https://www.w3.org/DesignIssues/HTTPFilenameMapping.html). So I'm fine with the It's not competing, it's complementary. |
|
||
// Create the path for a new file | ||
// Create the path for a new ressource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@RubenVerborgh @michielbdejong If you check the travis test only the version under node 10 fails. hope you like better the if sequence that has disappeared. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think this looks okay. Given the number of pull requests that have been made on this issue, I think it should be merged in.
@@ -45,7 +45,7 @@ async function handler (req, res, next) { | |||
|
|||
let ret | |||
try { | |||
ret = await ldp.get(options) | |||
ret = await ldp.get(options, req.accepts('html')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be better handled as
req.accepts(['text/turtle', 'application/ld+json', 'html']) === 'html'
so that we can handle requests where rdf has a higher weighted q value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I push your proposal (might be better ?) or do we keep it like it is ?
__
Just tried your proposal locally and npm run test
, it fails on :
- formats
turtle
should return turtle when listing container with an index page:
Error: expected "content-type" matching /text/html/, got "text/turtle"
So I propose to leave it like it is for node-solid-server EOL
Closing because fixed by a different pr |
recreate all for tests each step