diff --git a/packages/solid/src/resource/Leaf.ts b/packages/solid/src/resource/Leaf.ts index d735c55..1490a0b 100644 --- a/packages/solid/src/resource/Leaf.ts +++ b/packages/solid/src/resource/Leaf.ts @@ -78,7 +78,9 @@ export class Leaf extends Resource { */ constructor(uri: LeafUri, context: SolidLdoDatasetContext) { super(context); - this.uri = uri; + const uriObject = new URL(uri); + uriObject.hash = ""; + this.uri = uriObject.toString() as LeafUri; this.requester = new LeafBatchedRequester(uri, context); this.status = { isError: false, type: "unfetched", uri }; } @@ -342,6 +344,9 @@ export class Leaf extends Resource { async getRootContainer(): Promise< Container | CheckRootResultError | NoRootContainerError > { + // Check to see if this document has a pim:storage if so, use that + + // If not, traverse the tree const parent = await this.getParentContainer(); return parent.getRootContainer(); } diff --git a/packages/solid/test/Integration.test.ts b/packages/solid/test/Integration.test.ts index deba138..c86e7dc 100644 --- a/packages/solid/test/Integration.test.ts +++ b/packages/solid/test/Integration.test.ts @@ -217,6 +217,18 @@ describe("Integration", () => { }); }); + /** + * General + */ + describe("General", () => { + it("Does not include the hash when creating a resource", () => { + const resource = solidLdoDataset.getResource( + "https://example.com/thing#hash", + ); + expect(resource.uri).toBe("https://example.com/thing"); + }); + }); + /** * Read */