I am working on a PowerShell script to automate archiving files that are 5GB each. I am working directly with the API in PowerShell since BoxCLI does not utilize chunked uploads.
When running the “POST Upload Part of a File” command for the final chunk of a file, I am getting an error that the content-range is invalid. The final part of the file is not the same length as the rest of the parts, and the documentation states that is an allowed exception.
All initial parts upload without error, and return the expected values for the upload. When I run the final part using a content-range header value of “83886080-95925607/95925607” I get the following error:
{
"code": "range_out_of_bounds",
"message": "Part with offset 83886080 and size 12039528 exceeds limits of file size 95925607",
"request_id": "8642639592d5d19e401d2d252ba83641"
}
It looks like the API is ignoring the higher bound value provided in the content-range and using the higher bound that would be set if using the full part_size value defined when creating the session.
Is there an additional parameter that needs to be passed in with the final part to let the API know the size of this part may not match the predetermined part size?