Bug in Service API "episerverapi/commerce/import/upload/commit/"

Found in

EPiServer.ServiceApi 5.4.1

Fixed in

EPiServer.ServiceApi 5.4.3

Created

Jan 15, 2020

Updated

Mar 30, 2020

State

Closed, Fixed and tested


Description

Environment Information
Issue Description

The problem occurs when uploading files in chunks and then performing the commit, which attempts to merge the file chunks into a single file. The file parts seem to be processed in the wrong order.

When uploading a file in chunks, temporary files are created by Episerver with the following name pattern "startByte_endByte.split".

example:
file size: 11000 bytes
chunk size: 1000 bytes

This results in 11 split files in the episerver temp folder, named as follows.
0_1000.split
1000_2000.split
2000_3000.split
3000_4000.split
4000_5000.split
5000_6000.split
6000_7000.split
7000_8000.split
8000_9000.split
9000_10000.split
10000_11000.split

When performing the commit operation, Episerver processes them in the filename-order, resulting in a corrupted file after the merge.

The process order for this example would be (the items in red causing corrupted result):
0_1000.split
10000_11000.split
1000_2000.split

2000_3000.split
3000_4000.split
4000_5000.split
5000_6000.split
6000_7000.split
7000_8000.split
8000_9000.split
9000_10000.split