fix: Return 409 when there is a slash semantics issue

This commit is contained in:
Joachim Van Herwegen
2021-10-15 08:12:15 +02:00
parent 76c87bb56a
commit fb3a59c054
2 changed files with 2 additions and 2 deletions

View File

@@ -193,7 +193,7 @@ export class DataAccessorBasedStore implements ResourceStore {
// requests for the latter URI with a 301 redirect to the former."
// https://solid.github.io/specification/protocol#uri-slash-semantics
if (oldMetadata && oldMetadata.identifier.value !== identifier.path) {
throw new ForbiddenHttpError(`${identifier.path} conflicts with existing path ${oldMetadata.identifier.value}`);
throw new ConflictHttpError(`${identifier.path} conflicts with existing path ${oldMetadata.identifier.value}`);
}
const isContainer = this.isNewContainer(representation.metadata, identifier.path);

View File

@@ -358,7 +358,7 @@ describe('A DataAccessorBasedStore', (): void => {
representation.metadata.identifier = DataFactory.namedNode(`${resourceID.path}/`);
const prom = store.setRepresentation(resourceID, representation);
await expect(prom).rejects.toThrow(`${resourceID.path} conflicts with existing path ${resourceID.path}/`);
await expect(prom).rejects.toThrow(ForbiddenHttpError);
await expect(prom).rejects.toThrow(ConflictHttpError);
});
it('throws a 412 if the conditions are not matched.', async(): Promise<void> => {