We've been utilizing Azure Blob Storage to store pictures taken via our PowerApps. This works great and we had no problems until today.
We have an app containing checklists which is used by mechanics. One of the input types is 'Take/Upload a picture' which is currently used to take pre-delivery pictures before our vehicles are shipped to our customers. In our last update we've added the possibility to view and delete pictures before submitting the checklist to the database, and this is where things went downhill.
Upon taking a picture we store the filename (a GUID) in a local collection.
When the mechanic wants to delete this picture we call AzureBlobStorage.GetFileMetadataByPath() to retrieve the ID of that blob.
Using the ID we call AzureBlobStorage.DeleteFile() to delete that blob.
An error in the code caused the path to only contain the URL to the container instead of the full URL to a specific blob. The action GetFileMetadataByPath() responded with the ID of the container instead of the blob and we would use this to call the DeleteFile action resulting in the whole container being deleted. We hadn't activated the 'Soft delete' functionality yet for this storage account and we're currently waiting if MS can recover it from their side. Fingers crossed..
I had never imagined that the function DeleteFile could delete whole containers and I'm wondering if this is expected behavior or a bug. I think the question to ask is; is a container a blob (or a file as the name of the action suggests)?
The documentation says; "This operation deletes a blob." and today I discovered that it can also delete a whole container.
Soft recovery would have saved us a lot of hassle and I would advise everyone to enable that. It's also a good idea to check the 'IsFolder' property in the metadata of the file to make sure you're deleting a file/blob and not a whole container.
I wasn't sure where or how to post this, but I'm hoping that having this info out there might save somebody the stress this caused me today.. 😅
Peter

Report
All responses (
Answers (