Repository: solid/community-server (ts)

Issue:
Container metadata contains incorrect content-type
We get this when accessing a container (using a memory store):
```json
[
  {
    "@id": "http://localhost:3000/",
    "@type": [
      "http://www.w3.org/ns/ldp#Container",
      "http://www.w3.org/ns/ldp#BasicContainer",
      "http://www.w3.org/ns/ldp#Resource"
    ],
    "http://www.w3.org/ns/ldp#contains": [
      {
        "@id": "http://localhost:3000/.acl"
      }
    ],
    "http://www.w3.org/ns/ma-ont#format": [
      {
        "@value": "internal/quads"
      }
    ]
  }
]
```

The format is wrong here as these are no longer `internal/quads`. This is due to the fact that for containers the metadata is also used as data. We tried to get around this problem by delaying the data read as can be seen at 
https://github.com/solid/community-server/blob/1438fd81067a9b1f2befbd8b52d2255fe22e574e/src/storage/DataAccessorBasedStore.ts#L73-L76

But in hindsight this is not going to work as the converters are going to do a read and convert that data, and at that point it can't be changed anymore.

Pull request:
fix: Only set content-type for documents in sparql store
Closes #349 (again (hopefully))

Patch:
diff --git a/src/storage/accessors/SparqlDataAccessor.ts b/src/storage/accessors/SparqlDataAccessor.ts
index c67e1a3a3..dc6a7904a 100644
--- a/src/storage/accessors/SparqlDataAccessor.ts
+++ b/src/storage/accessors/SparqlDataAccessor.ts
@@ -95,7 +95,9 @@ export class SparqlDataAccessor implements DataAccessor {
     }
 
     const metadata = new RepresentationMetadata(identifier.path).addQuads(quads);
-    metadata.contentType = INTERNAL_QUADS;
+    if (!isContainerIdentifier(identifier)) {
+      metadata.contentType = INTERNAL_QUADS;
+    }
 
     // Need to generate type metadata for the root container since it's not stored
     if (identifier.path === this.base) {


Test patch:
diff --git a/test/unit/storage/accessors/SparqlDataAccessor.test.ts b/test/unit/storage/accessors/SparqlDataAccessor.test.ts
index 8c7e7e029..8b6842050 100644
--- a/test/unit/storage/accessors/SparqlDataAccessor.test.ts
+++ b/test/unit/storage/accessors/SparqlDataAccessor.test.ts
@@ -105,7 +105,6 @@ describe('A SparqlDataAccessor', (): void => {
     metadata = await accessor.getMetadata({ path: 'http://container/' });
     expect(metadata.quads()).toBeRdfIsomorphic([
       quad(namedNode('this'), namedNode('a'), namedNode('triple')),
-      quad(namedNode('http://container/'), toNamedNode(CONTENT_TYPE), literal(INTERNAL_QUADS)),
     ]);
 
     expect(fetchTriples).toHaveBeenCalledTimes(1);
@@ -123,7 +122,6 @@ describe('A SparqlDataAccessor', (): void => {
     metadata = await accessor.getMetadata({ path: base });
     expect(metadata.quads()).toBeRdfIsomorphic([
       quad(namedNode('this'), namedNode('a'), namedNode('triple')),
-      quad(namedNode(base), toNamedNode(CONTENT_TYPE), literal(INTERNAL_QUADS)),
       quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.Container)),
       quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.BasicContainer)),
       quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.Resource)),