File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ export class CompatibleAzExtTreeDataProvider extends IntermediateCompatibleAzExt
4747 }
4848
4949 public override async findTreeItem < T > ( fullId : string ) : Promise < T | undefined > {
50- const result = await this . tdp . findItemById ( fullId ) ;
50+ // compatibility with default resource to deploy setting, which value might be a v1 tree item id
51+ const id = convertV1TreeItemId ( fullId ) ;
52+ const result = await this . tdp . findItemById ( id ) ;
5153 return isWrapper ( result ) ? result . unwrap < T > ( ) : result as unknown as T ;
5254 }
5355
@@ -100,3 +102,12 @@ class ShouldNeverBeCalledError extends Error {
100102 super ( `${ methodName } should never be called.` ) ;
101103 }
102104}
105+
106+ /**
107+ * Convert v1 tree item id to Azure resource id.
108+ */
109+ export function convertV1TreeItemId ( id : string ) : string {
110+ // if full id contains two instances of subscriptions/ then remove everything before the second instance
111+ const regex = / ^ ( \/ s u b s c r i p t i o n s .* ) (?: \/ s u b s c r i p t i o n s ) / i;
112+ return id . replace ( regex , '/subscriptions' ) ;
113+ }
You can’t perform that action at this time.
0 commit comments