# Checklist
- [x] I have read the [contribution guidelines] (https://github.com/Azure/azure-iot-sdk-c/blob/main/.github/CONTRIBUTING.md).
- [ ] I added or modified the existing tests to cover the change (we do not allow our test coverage to go down).
- If this is a modification that impacts the behavior of a public API
- [ ] I edited the corresponding document in the `devdoc` folder and added or modified requirements.
- I submitted this PR against the correct branch:
- [x] This pull-request is submitted against the `main` branch.
- [x] I have merged the latest `main` branch prior to submission and re-merged as needed after I took any feedback.
- [x] I have squashed my changes into one with a clear description of the change.
# Reference/Link to the issue solved with this PR (if any)
https://github.com/Azure/azure-iot-sdk-c/issues/2569
https://github.com/Azure/azure-iot-sdk-c/issues/2614
# Description of the problem
The upload to blob logic was re-written, and the code in the convenience layer (iothub_client_core.c) became faulty since it does not expose all possible errors or exposes duplicate result status.
Description of the solution
As described in #2569 ,
"Capture the last callback invocation from IoTHubClientCore_LL_UploadMultipleBlocksToBlob (uploadToBlobMultiblockCallbackWrapper) or IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx (uploadToBlobMultiblockCallbackWrapperEx), no matter the result - name it blobStorageUploadResult
Save the result of the upload to blob API call (IoTHubClientCore_LL_UploadMultipleBlocksToBlob or IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx) - name it result
In uploadMultipleBlock_thread, after the upload to blob API call, if result is IOTHUB_CLIENT_OK and blobStorageUploadResult is FILE_UPLOAD_OK, invoke threadInfo->uploadBlobMultiblockSavedData.getDataCallback (or Ex) with FILE_UPLOAD_OK. Otherwise invoke it with FILE_UPLOAD_ERROR
That way, for the convenience layer the final callback will always be called after the whole upload to blob logic is completed."
The upload to blob logic was re-written, and the code in the convenience layer (iothub_client_core.c) became faulty since it does not expose all possible errors or exposes duplicate result status.
Description of the solution
As described in #2569 , "Capture the last callback invocation from IoTHubClientCore_LL_UploadMultipleBlocksToBlob (uploadToBlobMultiblockCallbackWrapper) or IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx (uploadToBlobMultiblockCallbackWrapperEx), no matter the result - name it blobStorageUploadResult Save the result of the upload to blob API call (IoTHubClientCore_LL_UploadMultipleBlocksToBlob or IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx) - name it result In uploadMultipleBlock_thread, after the upload to blob API call, if result is IOTHUB_CLIENT_OK and blobStorageUploadResult is FILE_UPLOAD_OK, invoke threadInfo->uploadBlobMultiblockSavedData.getDataCallback (or Ex) with FILE_UPLOAD_OK. Otherwise invoke it with FILE_UPLOAD_ERROR That way, for the convenience layer the final callback will always be called after the whole upload to blob logic is completed."