mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
change: Make RepresentationMetadata accept a ResourceIdentifier.
Closes https://github.com/solid/community-server/issues/388
This commit is contained in:
committed by
Joachim Van Herwegen
parent
6ee56a6d67
commit
accfc2e58d
@@ -370,7 +370,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
return {
|
||||
binary: true,
|
||||
data: guardedStreamFrom([]),
|
||||
metadata: new RepresentationMetadata(container.path),
|
||||
metadata: new RepresentationMetadata(container),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ export class FileDataAccessor implements DataAccessor {
|
||||
*/
|
||||
private async getBaseMetadata(link: ResourceLink, stats: Stats, isContainer: boolean):
|
||||
Promise<RepresentationMetadata> {
|
||||
const metadata = new RepresentationMetadata(link.identifier.path)
|
||||
const metadata = new RepresentationMetadata(link.identifier)
|
||||
.addQuads(await this.getRawMetadata(link.identifier));
|
||||
metadata.addQuads(generateResourceQuads(metadata.identifier as NamedNode, isContainer));
|
||||
metadata.addQuads(this.generatePosixQuads(metadata.identifier as NamedNode, stats));
|
||||
|
||||
@@ -28,7 +28,7 @@ export class InMemoryDataAccessor implements DataAccessor {
|
||||
public constructor(base: string) {
|
||||
this.base = ensureTrailingSlash(base);
|
||||
|
||||
const metadata = new RepresentationMetadata(this.base);
|
||||
const metadata = new RepresentationMetadata({ path: this.base });
|
||||
metadata.addQuads(generateResourceQuads(DataFactory.namedNode(this.base), true));
|
||||
this.store = { entries: {}, metadata };
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ export class SparqlDataAccessor implements DataAccessor {
|
||||
throw new NotFoundHttpError();
|
||||
}
|
||||
|
||||
const metadata = new RepresentationMetadata(identifier.path).addQuads(quads);
|
||||
const metadata = new RepresentationMetadata(identifier).addQuads(quads);
|
||||
if (!isContainerIdentifier(identifier)) {
|
||||
metadata.contentType = INTERNAL_QUADS;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ export class SparqlUpdatePatchHandler extends PatchHandler {
|
||||
this.logger.debug(`${store.size} quads will be stored to ${identifier.path}.`);
|
||||
|
||||
// Write the result
|
||||
const metadata = new RepresentationMetadata(identifier.path, { [CONTENT_TYPE]: INTERNAL_QUADS });
|
||||
const metadata = new RepresentationMetadata(identifier, { [CONTENT_TYPE]: INTERNAL_QUADS });
|
||||
const representation: Representation = {
|
||||
binary: false,
|
||||
data: guardStream(store.match() as Readable),
|
||||
|
||||
Reference in New Issue
Block a user