Skip to content

[Bug]: BlobClient.PutBlockList() unusable #615

Description

Describe the issue

While working with Azure Blob Services API module I found some inconsistencies and after analyzing it I want to share it.

The point is that PutBlockList cannot be used now.

procedure PutBlockList(CommitedBlocks: Dictionary of [Text, Integer]; UncommitedBlocks: Dictionary of [Text, Integer]): Codeunit "ABS Operation Response"

According to the documentation:
image

But at the same time PutBlock operation is not represented in the ABSBlobClient codeunit. Which makes it impossible to use the PutBlockList() method.

What is interesting is that in the implementation this method already exists and all we have to do is add it to the ABSBlobClient interface.

procedure PutBlock(SourceContentVariant: Variant; BlockId: Text): Codeunit "ABS Operation Response"

In addition, I think that the PutBlockList() method lacks the BlobName parameter because it is not clear at what point this name is implicitly received by ABSOperationPayload.

ABSOperationResponse := ABSWebRequestHelper.PutOperation(ABSOperationPayload, HttpContent, StrSubstNo(PutBlockOperationNotSuccessfulErr, ABSOperationPayload.GetBlobName()));

Expected behavior

This should work so that we can make multiple PutBlocks with a unique identifier in Base64 and then modify/add the blocks we need to get one initial Blob consisting of these blocks.

As example:

Put first uncommitted block:

curl --location --request PUT 'https://beedynamics.blob.core.windows.net/cronususainc/1/test1.txt?{SAS}&comp=block&blockid=MQ%3D%3D' \
--header 'x-ms-blob-type: BlockBlob' \
--header 'Content-Type: text/plain' \
--data 'part1'

Put second uncommitted block:

curl --location --request PUT 'https://beedynamics.blob.core.windows.net/cronususainc/1/test1.txt?{SAS}&comp=block&blockid=Mg%3D%3D' \
--header 'x-ms-blob-type: BlockBlob' \
--header 'Content-Type: text/plain' \
--data 'part2'

Commit two blocks as one Blob:

curl --location --request PUT 'https://beedynamics.blob.core.windows.net/cronususainc/1/test1.txt?{SAS}&comp=blocklist' \
--header 'Content-Type: application/xml' \
--data '<BlockList>  
  <Uncommitted>MQ==</Uncommitted>
  <Uncommitted>Mg==</Uncommitted>
</BlockList>  '

Steps to reproduce

Try to use PutBlockList

Additional context

I originally wanted to send a PR with a fix, but judging by the rules it has to be negotiated in Issue first. And yes I know AppendBlock works in a similar way and it works fine.

I will provide a fix for a bug

  • I will provide a fix for a bug

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ApprovedThe issue is approvedBugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions