Resources remove the hash automatically

main
Jackson Morgan 1 year ago
parent ce2c2a8d2b
commit a13851f29f
  1. 7
      packages/solid/src/resource/Leaf.ts
  2. 12
      packages/solid/test/Integration.test.ts

@ -78,7 +78,9 @@ export class Leaf extends Resource {
*/ */
constructor(uri: LeafUri, context: SolidLdoDatasetContext) { constructor(uri: LeafUri, context: SolidLdoDatasetContext) {
super(context); 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.requester = new LeafBatchedRequester(uri, context);
this.status = { isError: false, type: "unfetched", uri }; this.status = { isError: false, type: "unfetched", uri };
} }
@ -342,6 +344,9 @@ export class Leaf extends Resource {
async getRootContainer(): Promise< async getRootContainer(): Promise<
Container | CheckRootResultError | NoRootContainerError 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(); const parent = await this.getParentContainer();
return parent.getRootContainer(); return parent.getRootContainer();
} }

@ -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 * Read
*/ */

Loading…
Cancel
Save