Skip to content

Commit 5e4d894

Browse files
committed
UploadFromFileAsync adds the byte order mark (BOM) unicode character
1 parent 47bf889 commit 5e4d894

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/WebJobs.Script.WebHost/Security/KeyManagement/BlobStorageSecretsMigrationRepository.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ private async Task CopyKeysFromFileSystemToBlobStorage(BlobStorageSecretsReposit
132132
{
133133
string blobName = Path.GetFileName(file);
134134
CloudBlockBlob cloudBlockBlob = blobStorageSecretsRepository.BlobContainer.GetBlockBlobReference(blobStorageSecretsRepository.SecretsBlobPath + "/" + blobName);
135-
Task copyTask = cloudBlockBlob.UploadFromFileAsync(file);
135+
136+
string contents = File.ReadAllText(file);
137+
Task copyTask = cloudBlockBlob.UploadTextAsync(contents);
136138
copyTasks.Add(copyTask);
137139
_logger?.LogTrace("'{0}' was migrated.", cloudBlockBlob.StorageUri.PrimaryUri.AbsoluteUri.ToString());
138140
}

test/WebJobs.Script.Tests.Integration/Host/SecretsRepositoryMigrationTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public async Task SecretMigrate_Successful()
5454
var logs = loggerProvider.GetAllLogMessages().ToArray();
5555
Assert.Contains(logs[logs.Length - 1].FormattedMessage, "Finished successfully.");
5656
string hostContentFromBlob = await blobRepoMigration.ReadAsync(ScriptSecretsType.Host, "");
57-
Assert.Contains(hostContent, hostContentFromBlob);
57+
Assert.Equal(hostContent, hostContentFromBlob);
5858
string hostContentFromFunction = await blobRepoMigration.ReadAsync(ScriptSecretsType.Function, "test1");
59-
Assert.Contains(functionContent, hostContentFromFunction);
59+
Assert.Equal(functionContent, hostContentFromFunction);
6060

6161
var blobRepoMigration2 = _fixture.GetBlobStorageSecretsMigrationRepository(loggerProvider.CreateLogger(""));
6262
await blobRepoMigration2.ReadAsync(ScriptSecretsType.Host, "host");
@@ -105,7 +105,6 @@ public async Task SecretMigrate_Conflict()
105105
{
106106
_settingsManager.SetSetting(EnvironmentSettingNames.AzureWebsiteSlotName, null);
107107
_settingsManager.SetSetting(EnvironmentSettingNames.AzureWebsiteName, null);
108-
109108
}
110109
}
111110
}

0 commit comments

Comments
 (0)