Skip to content

Conversation

@jaxoncreed
Copy link
Contributor

Fixes#1226

path = path.substring(this._rootPath.length)
}
if (this._includeHost){
console.log(path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😉

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that

path = path.substring(this._rootPath.length)
}
if (this._includeHost){
if (!path.startsWith(`/${hostname}`)){
Copy link
Contributor

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).

Copy link
Contributor

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.

if (!path.startsWith(`/${hostname}`)){
throw new Error(`Path must start with hostname (/${hostname})`)
}
path = path.substring(`/${hostname}`.length)
Copy link
Contributor

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.

acl:trustedApp
[ acl:mode acl:Read, acl:Write; acl:origin <https://app.example.com> ].
c0:me
c:me
Copy link
Contributor

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 : / <#>.

@jaxoncreed
Copy link
ContributorAuthor

@RubenVerborgh Everything look good?

Copy link
Contributor

@RubenVerborghRubenVerborgh left a 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
Copy link
Contributor

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.

path: `${rootPath}example.orgspace/foo.html`,
hostname: 'example.org'
}).then(() => done('Did not throw error'))
.catch(() => done())
Copy link
Contributor

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
Copy link
ContributorAuthor

@RubenVerborgh can you please approve. We need to get this in asap

@RubenVerborgh
Copy link
Contributor

@jaxoncreed All good, excellent work on this!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected 409 response on PATCH

3 participants

@jaxoncreed@RubenVerborgh