Skip to content

Commit

Permalink
fix: Return 409 when there is a slash semantics issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimvh committed Oct 15, 2021
1 parent 76c87bb commit fb3a59c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/storage/DataAccessorBasedStore.ts
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/storage/DataAccessorBasedStore.test.ts
Expand Up @@ -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> => {
Expand Down

0 comments on commit fb3a59c

Please sign in to comment.