While using the UploadApp.ps1 script, the script shows a successfully uploaded app but does not appear on the UEM Console, and from the MAM API logs, we can see the Internal server error.
Reproduction steps
Update all the required details on the script for the targetted console and file location.
Disable File Storage on the Console so the application goes to the database.
Run the PowerShell script.
Expected behavior
The application is successfully uploaded to the console and is visible on the UI.
Additional context
The issue is due to the fact that we are first creating a chunk byte array
This would mean that for the last chunk since the data would be almost always less than the $ChunkSize, we are sending trailing empty bytes in the request byte array. This is causing overflow on the server as it is trying to write the trailing bytes to a smaller array.
Describe the bug
While using the UploadApp.ps1 script, the script shows a successfully uploaded app but does not appear on the UEM Console, and from the MAM API logs, we can see the Internal server error.
Reproduction steps
Expected behavior
The application is successfully uploaded to the console and is visible on the UI.
Additional context
The issue is due to the fact that we are first creating a chunk byte array
$chunk = New-Object byte[] $ChunkSize
and then preparing the whole array for upload:
$b64Chunk = [System.Convert]::ToBase64String($chunk)
This would mean that for the last chunk since the data would be almost always less than the
$ChunkSize
, we are sending trailing empty bytes in the request byte array. This is causing overflow on the server as it is trying to write the trailing bytes to a smaller array.