From d62b94db316d6d972594260a146c7191e43e43df Mon Sep 17 00:00:00 2001 From: Ariel Silverman Date: Wed, 4 Oct 2023 13:02:56 -0700 Subject: [PATCH] CodeFix: Remove relative path prefix from types loading (#12026) ## Description The current implementation makes the wrong assumption that the key names indexed in the types cache have a prefix `./`. This was the case when I was using a dev artifact since the publishing logic wasn't ready. Now that we have a publishing logic for the types package we can fix the code so that it doesn't assume the `./` prefix is found in the files as proven by https://github.com/Azure/bicep-types-az/actions/runs/6398352791/job/17368317634. This PR should be merged before https://github.com/Azure/bicep-types-az/pull/1553, and https://github.com/Azure/bicep-types-az/pull/1553 should be updated to download the latest build from the `main` branch. ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/12026) --------- Co-authored-by: Ariel Silverman --- .vscode/launch.json | 9 ++++----- src/Bicep.Core/TypeSystem/Az/OciAzTypeLoader.cs | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 01248b0d439..f6c9191dae5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -32,10 +32,9 @@ "build", "${file}" ], - "env": { - "BICEP_TRACING_ENABLED": "true", - // "BICEP_REGISTRY_FQDN": "your-registry-here.azurecr.io" - }, + "env": { + "BICEP_TRACING_ENABLED": "true" + }, "cwd": "${workspaceFolder}/src/Bicep.Cli", "console": "internalConsole", "stopAtEntry": false @@ -51,7 +50,7 @@ "${file}" ], "env": { - "BICEP_TRACING_ENABLED": "true" + "BICEP_TRACING_ENABLED": "true", }, "cwd": "${workspaceFolder}/src/Bicep.Cli", "console": "internalConsole", diff --git a/src/Bicep.Core/TypeSystem/Az/OciAzTypeLoader.cs b/src/Bicep.Core/TypeSystem/Az/OciAzTypeLoader.cs index 8ab6d1ee78a..009b8d684dd 100644 --- a/src/Bicep.Core/TypeSystem/Az/OciAzTypeLoader.cs +++ b/src/Bicep.Core/TypeSystem/Az/OciAzTypeLoader.cs @@ -53,7 +53,7 @@ public static OciAzTypeLoader FromTgz(string pathToGzip) protected override Stream GetContentStreamAtPath(string path) { - if (this.typesCache.TryGetValue($"./{path}", out var bytes)) + if (this.typesCache.TryGetValue($"{path}", out var bytes)) { return new MemoryStream(bytes); }