Skip to content

Commit

Permalink
Lowercase ACR package name when pushing to server (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
alerickson authored Feb 8, 2024
1 parent 6b4cf0a commit 58d5940
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/code/ACRServerAPICalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,8 +1106,8 @@ internal bool PushNupkgACR(string psd1OrPs1File, string outputNupkgDir, string p
{
errRecord = null;
// Push the nupkg to the appropriate repository
var fullNupkgFile = System.IO.Path.Combine(outputNupkgDir, pkgName + "." + pkgVersion.ToNormalizedString() + ".nupkg");

string fullNupkgFile = System.IO.Path.Combine(outputNupkgDir, pkgName + "." + pkgVersion.ToNormalizedString() + ".nupkg");
string pkgNameLower = pkgName.ToLower();
string accessToken = string.Empty;
string tenantID = string.Empty;

Expand Down Expand Up @@ -1136,7 +1136,8 @@ internal bool PushNupkgACR(string psd1OrPs1File, string outputNupkgDir, string p

/* Uploading .nupkg */
_cmdletPassedIn.WriteVerbose("Start uploading blob");
var moduleLocation = GetStartUploadBlobLocation(registry, pkgName, acrAccessToken).Result;
// Note: ACR registries will only accept a name that is all lowercase.
var moduleLocation = GetStartUploadBlobLocation(registry, pkgNameLower, acrAccessToken).Result;

_cmdletPassedIn.WriteVerbose("Computing digest for .nupkg file");
bool nupkgDigestCreated = CreateDigest(fullNupkgFile, out string nupkgDigest, out ErrorRecord nupkgDigestError);
Expand All @@ -1159,7 +1160,7 @@ internal bool PushNupkgACR(string psd1OrPs1File, string outputNupkgDir, string p
}
using (FileStream configStream = new FileStream(emptyFilePath, FileMode.Create)){ }
_cmdletPassedIn.WriteVerbose("Start uploading an empty file");
var emptyLocation = GetStartUploadBlobLocation(registry, pkgName, acrAccessToken).Result;
var emptyLocation = GetStartUploadBlobLocation(registry, pkgNameLower, acrAccessToken).Result;
_cmdletPassedIn.WriteVerbose("Computing digest for empty file");
bool emptyDigestCreated = CreateDigest(emptyFilePath, out string emptyDigest, out ErrorRecord emptyDigestError);
if (!emptyDigestCreated)
Expand Down Expand Up @@ -1200,7 +1201,7 @@ internal bool PushNupkgACR(string psd1OrPs1File, string outputNupkgDir, string p
File.WriteAllText(configFilePath, fileContent);

_cmdletPassedIn.WriteVerbose("Create the manifest layer");
bool manifestCreated = CreateManifest(registry, pkgName, pkgVersion.OriginalVersion, configFilePath, true, acrAccessToken).Result;
bool manifestCreated = CreateManifest(registry, pkgNameLower, pkgVersion.OriginalVersion, configFilePath, true, acrAccessToken).Result;

if (manifestCreated)
{
Expand Down

0 comments on commit 58d5940

Please sign in to comment.