mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Prevent errors in JSON storage when data is invalid
This commit is contained in:
@@ -5,7 +5,7 @@ import type { ResourceIdentifier } from '../../../../src/http/representation/Res
|
||||
import { JsonResourceStorage } from '../../../../src/storage/keyvalue/JsonResourceStorage';
|
||||
import type { ResourceStore } from '../../../../src/storage/ResourceStore';
|
||||
import { NotFoundHttpError } from '../../../../src/util/errors/NotFoundHttpError';
|
||||
import { isContainerIdentifier } from '../../../../src/util/PathUtil';
|
||||
import { isContainerIdentifier, joinUrl } from '../../../../src/util/PathUtil';
|
||||
import { readableToString } from '../../../../src/util/StreamUtil';
|
||||
import { LDP } from '../../../../src/util/Vocabularies';
|
||||
|
||||
@@ -112,6 +112,9 @@ describe('A JsonResourceStorage', (): void => {
|
||||
data.set(containerIdentifier, '');
|
||||
data.set(subContainerIdentifier, '');
|
||||
|
||||
// Manually setting invalid data which will be ignored
|
||||
data.set(joinUrl(containerIdentifier, 'badData'), 'invalid JSON');
|
||||
|
||||
const entries = [];
|
||||
for await (const entry of storage.entries()) {
|
||||
entries.push(entry);
|
||||
|
||||
Reference in New Issue
Block a user