@@ -3,15 +3,16 @@ import arrayifyStream from 'arrayify-stream';
3
3
import { DataFactory } from 'n3' ;
4
4
import { v4 as uuid } from 'uuid' ;
5
5
import type { AuxiliaryStrategy } from '../http/auxiliary/AuxiliaryStrategy' ;
6
+ import { BadRequestHttpError } from '../util/errors/BadRequestHttpError' ;
6
7
import { BasicRepresentation } from '../http/representation/BasicRepresentation' ;
7
8
import type { Patch } from '../http/representation/Patch' ;
8
9
import type { Representation } from '../http/representation/Representation' ;
9
10
import { RepresentationMetadata } from '../http/representation/RepresentationMetadata' ;
10
11
import type { ResourceIdentifier } from '../http/representation/ResourceIdentifier' ;
11
12
import { getLoggerFor } from '../logging/LogUtil' ;
12
13
import { INTERNAL_QUADS } from '../util/ContentTypes' ;
13
- import { BadRequestHttpError } from '../util/errors/BadRequestHttpError' ;
14
14
import { ConflictHttpError } from '../util/errors/ConflictHttpError' ;
15
+ import { RedirectHttpError } from '../util/errors/RedirectHttpError' ;
15
16
import { createErrorMessage } from '../util/errors/ErrorUtil' ;
16
17
import { ForbiddenHttpError } from '../util/errors/ForbiddenHttpError' ;
17
18
import { MethodNotAllowedHttpError } from '../util/errors/MethodNotAllowedHttpError' ;
@@ -116,8 +117,12 @@ export class DataAccessorBasedStore implements ResourceStore {
116
117
isMetadata = true ;
117
118
}
118
119
119
- // In the future we want to use getNormalizedMetadata and redirect in case the identifier differs
120
- let metadata = await this . accessor . getMetadata ( identifier ) ;
120
+ let metadata = await this . getNormalizedMetadata ( identifier ) ;
121
+ // Redirect in case the identifier differs
122
+ if ( metadata . identifier . value !== identifier . path ) {
123
+ throw new RedirectHttpError ( 302 , 'Found' , metadata . identifier . value ) ;
124
+ }
125
+
121
126
let representation : Representation ;
122
127
123
128
// Potentially add auxiliary related metadata
0 commit comments