- Notifications
You must be signed in to change notification settings - Fork 305
Patch fix#1227
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
Patch fix #1227
Uh oh!
There was an error while loading. Please reload this page.
Conversation
lib/resource-mapper.js Outdated
| path = path.substring(this._rootPath.length) | ||
| } | ||
| if (this._includeHost){ | ||
| console.log(path) |
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.
😉
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.
Sorry about that
lib/resource-mapper.js Outdated
| path = path.substring(this._rootPath.length) | ||
| } | ||
| if (this._includeHost){ | ||
| if (!path.startsWith(`/${hostname}`)){ |
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.
Needs to start with /${hostname}/ (otherwise, hostname prefixes would also be allowed).
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.
Might want to add a negative test for the slashless case.
lib/resource-mapper.js Outdated
| if (!path.startsWith(`/${hostname}`)){ | ||
| throw new Error(`Path must start with hostname (/${hostname})`) | ||
| } | ||
| path = path.substring(`/${hostname}`.length) |
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.
No need to create a new string just for length; let' take hostname.length + 1.
Uh oh!
There was an error while loading. Please reload this page.
| acl:trustedApp | ||
| [ acl:mode acl:Read, acl:Write; acl:origin <https://app.example.com> ]. | ||
| c0:me | ||
| c:me |
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.
Two different mes probably means trouble. Should be both the same, so both : / <#>.
Uh oh!
There was an error while loading. Please reload this page.
jaxoncreed commented Jun 13, 2019
@RubenVerborgh Everything look good? |
RubenVerborgh left a comment
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.
One concern about an RDF file remaining.
| acl:trustedApp | ||
| [ acl:mode acl:Read, acl:Write; acl:origin <https://app.example.com> ]. | ||
| c0:me | ||
| c:me |
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.
I still think these are wrong. Both should be :me. Somehow, the RDF serializer is getting the wrong URL.
Uh oh!
There was an error while loading. Please reload this page.
test/unit/resource-mapper-test.js Outdated
| path: `${rootPath}example.orgspace/foo.html`, | ||
| hostname: 'example.org' | ||
| }).then(() => done('Did not throw error')) | ||
| .catch(() => done()) |
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.
Nit: you can just write that as
it('throws an error when there is an improper file path',()=>{returnexpect(mapper.mapFileToUrl({path: `${rootPath}example.orgspace/foo.html`,hostname: 'example.org'})).to.be.rejectedWith(newError('error message'))})and simultaneously test the error message. (return necessary because it's a promise)
jaxoncreed commented Jun 14, 2019
@RubenVerborgh can you please approve. We need to get this in asap |
RubenVerborgh commented Jun 14, 2019
@jaxoncreed All good, excellent work on this! |
Fixes#1226