From aafc700d738f884680a95641f8bd6f7e33f5d103 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 22 Jun 2016 15:54:07 -0500 Subject: [PATCH] Fixing AzurePublisher to upload files to the correct URL. Previously it was duplicating the full URL inside of the blob container. --- build_projects/dotnet-cli-build/PublishTargets.cs | 2 +- .../Publishing/AzurePublisher.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build_projects/dotnet-cli-build/PublishTargets.cs b/build_projects/dotnet-cli-build/PublishTargets.cs index a0fb5829a..a70a4b61e 100644 --- a/build_projects/dotnet-cli-build/PublishTargets.cs +++ b/build_projects/dotnet-cli-build/PublishTargets.cs @@ -239,7 +239,7 @@ namespace Microsoft.DotNet.Cli.Build var packageName = CliMonikers.GetSdkDebianPackageName(c); var installerFile = c.BuildContext.Get("SdkInstallerFile"); - var uploadUrl = AzurePublisher.CalculateUploadUrlForFile(installerFile, AzurePublisher.Product.Sdk, version); + var uploadUrl = AzurePublisher.CalculateFullUrlForFile(installerFile, AzurePublisher.Product.Sdk, version); DebRepoPublisherTool.PublishDebFileToDebianRepo( packageName, diff --git a/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs b/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs index 2df903d3e..35d0afde7 100644 --- a/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs +++ b/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs @@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Cli.Build public string UploadFile(string file, Product product, string version) { - string url = CalculateUploadUrlForFile(file, product, version); + string url = CalculateRelativePathForFile(file, product, version); CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(url); blob.UploadFromFileAsync(file, FileMode.Open).Wait(); SetBlobPropertiesBasedOnFileType(blob); @@ -194,9 +194,14 @@ namespace Microsoft.DotNet.Cli.Build _blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait(); } - public static string CalculateUploadUrlForFile(string file, Product product, string version) + public static string CalculateFullUrlForFile(string file, Product product, string version) { - return $"{s_dotnetBlobRootUrl}/{product}/{version}/{Path.GetFileName(file)}"; + return $"{s_dotnetBlobRootUrl}/{CalculateRelativePathForFile(file, product, version)}"; + } + + private static string CalculateRelativePathForFile(string file, Product product, string version) + { + return $"{product}/{version}/{Path.GetFileName(file)}"; } public static async Task DownloadFile(string blobFilePath, string localDownloadPath)