Azure / azure-storage-java

Microsoft Azure Storage Library for Java
https://docs.microsoft.com/en-us/java/api/overview/azure/storage
MIT License
189 stars 165 forks source link

Folder with container name is always constructed. #553

Open JardarM opened 3 years ago

JardarM commented 3 years ago

We are using SDK v12 (12.8.0) and uploading blob files to azure storage.

The problem is that the API seems to create a "root" folder for the container, which seems odd.

The code below creates this file in container box: box/test/myfile.txt while I would expect this: test/myfile.txt

var localfile = "test.txt";
var containerName = "box";
var file = "test/myfile.txt";
var sc = new StorageCredentialsSharedAccessSignature(sasToken.Token);
var container = new CloudBlobClient(URI.create(sasToken.Uri),sc).getContainerReference(containerName);
var blobRef = container.getBlockBlobReference(file);
blobRef.uploadFromFile(localfile)