Skip to content

Commit

Permalink
create if not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
yodobrin committed Dec 20, 2022
1 parent fadb615 commit 455859a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aca/Controllers/BlobController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public async Task<ActionResult<string>> CopyBlob(BlobRequest item)
string targetCS = _configuration.GetValue<string>(item.TargetCS);

BlobContainerClient sourceBlobClient = new BlobContainerClient(sourceCS,item.SourceContainer);
sourceBlobClient.CreateIfNotExists();
BlobContainerClient targetBlobClient = new BlobContainerClient(targetCS,item.TargetContainer);
targetBlobClient.CreateIfNotExists();
string sas = GetServiceSasUriForContainer(sourceBlobClient);
// create uri for the download
if(BLOB.Equals(item.RequestType) && !string.IsNullOrEmpty(sas)){
Expand All @@ -58,6 +60,7 @@ public async Task<ActionResult<string>> CopyBlob(BlobRequest item)
long btime = DateTime.Now.Ticks;
// download the file to a temporary location (sample container)
BlobContainerClient localBlobClient = new BlobContainerClient(sourceCS,TEMP_LOC);
localBlobClient.CreateIfNotExists();
// using a unique name for the file
string localFileTemp = Guid.NewGuid().ToString();
BlobClient localBlob = localBlobClient.GetBlobClient(localFileTemp);
Expand Down

0 comments on commit 455859a

Please sign in to comment.