QuentinCG / QAzureStorageRestApi

[Done] Standalone Azure Storage REST API client for Qt5+ & Qt6+ (Tested with Qt 5.12.12 & Qt 6.2.3)
MIT License
2 stars 4 forks source link

Remove a file in a Blob Container #10

Closed fverneau closed 11 months ago

fverneau commented 11 months ago

We can upload and download file in blob container, but would it be possible to have a function to delete a file in a Blob Container?

QuentinCG commented 11 months ago

I added this feature in master (you need to download github repo).

Here is how to do it (exactly like list/download/upload):

QNetworkReply* deleteFileReply = azure->deleteFile(container, azureFilenameToDelete); (...)

https://github.com/QuentinCG/QAzureStorageRestApi/blob/master/example/main.cpp#L139

Can you please confirm it works ?

fverneau commented 11 months ago

There are errors in QAzureStorageRestApi.cpp (lines 234 and 235) : request.setRawHeader(QByteArray("Content-Length"),QByteArray(QString::number(contentLength).toStdString().c_str())); request.setRawHeader(QByteArray("x-ms-blob-type"),QByteArray(blobType.toStdString().c_str())); contentLength and blobType aren't declared

fverneau commented 11 months ago

QAzureStorageRestApi.cpp - line 237 : return m_manager->delete(request); I think it would be : return m_manager->deleteResource(request);

QuentinCG commented 11 months ago

it should work now (sorry, I don't have access to a compiler to test the source code I edit right now)

Can you confirm it works ?

fverneau commented 11 months ago

I confirm : it works very well ! When a file is in subdirectories, the subdirectories are deleted too. Perfect !