change: Make RepresentationMetadata accept a ResourceIdentifier.

Closes https://github.com/solid/community-server/issues/388
This commit is contained in:
Ruben Verborgh
2020-12-10 16:24:38 +00:00
committed by Joachim Van Herwegen
parent 6ee56a6d67
commit accfc2e58d
13 changed files with 53 additions and 39 deletions

View File

@@ -51,7 +51,7 @@ export class TemplatedResourcesGenerator implements ResourcesGenerator {
representation: {
binary: true,
data: guardedStreamFrom([]),
metadata: new RepresentationMetadata(link.identifier.path),
metadata: new RepresentationMetadata(link.identifier),
},
};
@@ -74,7 +74,7 @@ export class TemplatedResourcesGenerator implements ResourcesGenerator {
private async generateDocument(filePath: string, mapper: FileIdentifierMapper, options: Dict<string>):
Promise<Resource> {
const link = await mapper.mapFilePathToUrl(filePath, false);
const metadata = new RepresentationMetadata(link.identifier.path);
const metadata = new RepresentationMetadata(link.identifier);
metadata.contentType = link.contentType;
const raw = await fsPromises.readFile(filePath, 'utf8');