Closed ayedo closed 4 years ago
Hi, @ayedo Thank you for opening this issue. I suspect that you maybe have some experience using CloudBlockBlob in v8. In v8, when you call setBlobProperties (which then included content type), it sets a property on the CloudBlockBlob object that is uploaded when you either call uploadProperties or just upload. When you call setHttpHeaders on a blobClient in v12, it actually issues a request to set the properties on an object at that time, but you haven't yet created the object, which is why you're seeing a 404. If you want the properties to be set at the time of blob creation, you should pass them into the getBlobOutputStream() method of BlockBlobClient.
Please let me know if you have further questions or if this doesn't resolve your issue.
@rickle-msft thank you for your reply. That did solve the problem :)
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the SDK was used?
v12
What problem was encountered?
I'm trying to set the content type of a blob I upload. I found out that I need to set BlobHttpHeaders for that, but when I do the creation throws a 404 ResoucreNotFound Exception.
val blobClient = containerClient.getBlobClient(documentUuid.toString()) val blockClient = blobClient.blockBlobClient blockClient.setHttpHeaders(BlobHttpHeaders().setContentType("application/pdf")) blobClient.blockBlobClient.blobOutputStream.use { s -> s.write(byteArray) }
Have you found a mitigation/solution?
No.