Commit cc2b037 1 parent 0ceec80 commit cc2b037 Copy full SHA for cc2b037
File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ import {IConstruct} from 'constructs';
3
3
4
4
export class FixPathsMetadataAspect implements IAspect {
5
5
public visit ( node : IConstruct ) : void {
6
- const possibleL1 = node . node . defaultChild ? node . node . defaultChild : node ;
7
- if ( possibleL1 instanceof CfnResource && node . node . path ) {
6
+ if ( node instanceof CfnResource && typeof node . getMetadata ( 'aws:cdk:path' ) === 'string' ) {
8
7
const stackId = Stack . of ( node ) . node . id ;
9
- const parts = node . node . path . split ( '/' ) ;
8
+ const parts = ( node . getMetadata ( 'aws:cdk: path' ) as string ) . split ( '/' ) ;
10
9
if ( parts . indexOf ( stackId ) !== - 1 ) {
11
- possibleL1 . addMetadata ( 'aws:cdk:path' , parts . slice ( parts . indexOf ( stackId ) ) . join ( '/' ) ) ;
10
+ node . addMetadata ( 'aws:cdk:path' , parts . slice ( parts . indexOf ( stackId ) ) . join ( '/' ) ) ;
12
11
}
13
12
}
14
13
}
You can’t perform that action at this time.
0 commit comments