diff --git a/src/fetcher.ts b/src/fetcher.ts index cb449c11c..6fb438e9a 100644 --- a/src/fetcher.ts +++ b/src/fetcher.ts @@ -601,7 +601,11 @@ class N3Handler extends Handler { ): ExtendedResponse | Promise { // Parse the text of this N3 file let kb = fetcher.store - let p = N3Parser(kb, kb, options.original.value, options.original.value, + let baseUrl = options.original.value + const isContainer = kb.any(options.original, null, ns.ldp('Container')) + // console.log('@@ isContainer ' + isContainer) + if (isContainer && !baseUrl.endsWith('/')) baseUrl = baseUrl + '/' + let p = N3Parser(kb, kb, baseUrl, baseUrl, null, null, '', null) // p.loadBuf(xhr.responseText) try { diff --git a/src/update-manager.ts b/src/update-manager.ts index 4478c7b6a..2335478c7 100644 --- a/src/update-manager.ts +++ b/src/update-manager.ts @@ -598,7 +598,7 @@ flagAuthorizationMetadata (kb?: IndexedFormula) { } } else { control.reloading = false - if ((response as Response).status === 0) { + if (!response || (response as Response).status === 0) { // alain // console.log('Network error refreshing the data. Retrying in ' + // retryTimeout / 1000) control.reloading = true diff --git a/tests/unit/fetcher-test.js b/tests/unit/fetcher-test.js index a949bd3c1..1827bc87c 100644 --- a/tests/unit/fetcher-test.js +++ b/tests/unit/fetcher-test.js @@ -566,7 +566,27 @@ describe('Fetcher', () => { }) }) - describe('createContainer', () => { + /* describe('301 redirect', () => { + let fetcher + + beforeEach(() => { + fetcher = new Fetcher(rdf.graph()) + }) + + afterEach(() => { + nock.cleanAll() + }) + // it.skip('should invoke webOperation with the right options', () => {}) - }) + it("should contain nothing", async () => { + const store = rdf.graph(); + const fetcher = new Fetcher(store); + await fetcher.load("https://bourgeoa.solidcommunity.net/chats"); + const contains = store.statementsMatching( + rdf.sym("https://bourgeoa.solidcommunity.net/chats"), + rdf.sym("http://www.w3.org/ns/ldp#contains") + ); + expect(contains.length).to.equal(0); + }); + }) */ })