microsoft / fhir-loader

Bulk FHIR Data Loader
MIT License
44 stars 39 forks source link

WriteStringToBlob falls through to exception in StorageUtils.cs #48

Closed sordahl-ga closed 1 year ago

sordahl-ga commented 1 year ago

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;**
        }