Changes to allow append blob support introduced defect to where code falls through to exception. The following code block:
if (sourceBlob.BlobType == BlobType.BlockBlob)
{
await ((CloudBlockBlob)sourceBlob).UploadTextAsync(contents);
}
if (sourceBlob.BlobType == BlobType.AppendBlob)
{
byte[] bytes = Encoding.UTF8.GetBytes(contents);
// Write the bytes to the blob
using MemoryStream stream = new MemoryStream(bytes);
await ((CloudAppendBlob) sourceBlob).AppendBlockAsync(stream);
}
Should be Changed to:
if (sourceBlob.BlobType == BlobType.BlockBlob)
{
await ((CloudBlockBlob)sourceBlob).UploadTextAsync(contents);
return;
}
if (sourceBlob.BlobType == BlobType.AppendBlob)
{
byte[] bytes = Encoding.UTF8.GetBytes(contents);
// Write the bytes to the blob
using MemoryStream stream = new MemoryStream(bytes);
await ((CloudAppendBlob) sourceBlob).AppendBlockAsync(stream);
**return;**
}
Changes to allow append blob support introduced defect to where code falls through to exception. The following code block: if (sourceBlob.BlobType == BlobType.BlockBlob) { await ((CloudBlockBlob)sourceBlob).UploadTextAsync(contents); }
Should be Changed to: if (sourceBlob.BlobType == BlobType.BlockBlob) { await ((CloudBlockBlob)sourceBlob).UploadTextAsync(contents); return;
}