-
Notifications
You must be signed in to change notification settings - Fork 146
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
301 redirect : Wrong containment triples when fetching Container from NSS without trailing slash #617
Comments
When a container URL is without a /, NSS is using a 301 redirect to a new URL ending with a / @timbl I am wondering if rdflib does check the header for |
When a server receives a GET request to
It may do the optional:
|
This comment was marked as resolved.
This comment was marked as resolved.
Here are all the headers:
|
So you are saying it looks as though rdflib uses the location of the initial resource not the one after the redirect, as a base address for parsing the data. |
This comment was marked as resolved.
This comment was marked as resolved.
Yes. When I looked at rdflib code I did not find any use of |
In the Handle fetch() response
|
Yes, I suppose in case of a 301 redirect rdflib should use the URI of the location header as the base URI, not the URI it requested initially and got redirected. |
In https://github.com/linkeddata/rdflib.js/blob/main/src/fetcher.ts#L604 maybe |
Well I just found out the same @timbl already said 😅. But yes, I can confirm that's the problem. I've tried to reproduce the issue, and changing the following in https://github.com/linkeddata/rdflib.js/blob/main/src/fetcher.ts#L1161 the test passes: .then(response => {
if (options.baseURI !== response.url) {
options.baseURI = response.url;
}
if (options.original.value !== response.url) {
options.original.value = response.url;
}
return this.handleResponse(response, response.url, options);
}, Not that this should be the solution, but it proves that the issue was indeed that the redirect was happening silently. |
I found the same and checking for the Link Container in response of latest fetch does resolve the issue. Replace https://github.com/linkeddata/rdflib.js/blob/main/src/fetcher.ts#L604
|
@angelo-v |
It fixes the issue with wrong containment triples. But still rdflib states that the resource without a trailing slash is of type |
@angelo-v |
@angelo-v |
Steps to reproduce
ldp:contains
as predicateExpected result
The canonical container URI is with a slash, so the query should not give a result
Actual result
A statement with a wrong relative URI as the object
Example
Correct containment statement would be
This statement is not in the store, besides following the redirect from NSS. Only when fetching directly with a trailing shlash everything works as expected.
Test to reproduce:
The text was updated successfully, but these errors were encountered: