From c1be366d3ba2df2538fcff47107d3741be243c10 Mon Sep 17 00:00:00 2001 From: Julian Rojas Date: Tue, 5 Mar 2024 16:50:02 +0100 Subject: [PATCH] Hack to deal with metadata actor bug --- packages/actor-init-ldes-client/lib/EventStream.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/actor-init-ldes-client/lib/EventStream.ts b/packages/actor-init-ldes-client/lib/EventStream.ts index 6184794..5d146d6 100644 --- a/packages/actor-init-ldes-client/lib/EventStream.ts +++ b/packages/actor-init-ldes-client/lib/EventStream.ts @@ -294,13 +294,16 @@ export class EventStream extends Readable { * https://semiceu.github.io/LinkedDataEventStreams/example.ttl#eventstream * gets changed to: * https://semiceu.github.io/linkeddataeventstreams/example.ttl#eventstream - * which prevents tree:views to get booked + * which prevents tree:views to get booked. + * + * It also removes trailing slashes, which is incorrect. */ + let safePageUrl = pageUrl.endsWith("/") ? pageUrl.slice(0, -1) : pageUrl; - if (treeMetadata.metadata.treeMetadata.collections.get(pageUrl) - && treeMetadata.metadata.treeMetadata.collections.get(pageUrl)["view"]) { + if (treeMetadata.metadata.treeMetadata.collections.get(safePageUrl) + && treeMetadata.metadata.treeMetadata.collections.get(safePageUrl)["view"]) { // take first view encountered - const view = treeMetadata.metadata.treeMetadata.collections.get(pageUrl)["view"][0]["@id"]; + const view = treeMetadata.metadata.treeMetadata.collections.get(safePageUrl)["view"][0]["@id"]; this.bookkeeper.addFragment(view, 0); this.logger.debug(`Scheduled TREE view (${view}) for retrieval`); } else if (treeMetadata.metadata.treeMetadata.collections.get(pageUrlWithoutWWW)