Merge pull request #45 from o-development/fix/url-hash

Resources remove the hash automatically
main
jaxoncreed 1 year ago committed by GitHub
commit 6a89deacfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  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) {
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();
}

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

Loading…
Cancel
Save