Upload reports wrong file size on StartedEvent

Hello, we are using the Upload component to upload files to a legacy system, the legacy system API requires to know the length of the file while performing the upload. In Vaadin 8 we used to get the file size when the upload started through the Start event. In Vaadin 23 we noticed the size of the file is wrong. The function StartedEvent.getContentLength() seems to be returning the size of the payload rather than the size of the file.

I do see the size of the file is correct in the client side when the file is added to the form data, but when I implement addUploadRequestListener and addUploadBeforeListener, they both fail with a cast exception error: elemental.json.impl.JreJsonString to elemental.json.JsonObject, despite the error it seems to go through but I size is not available when I try to get the “size” property in the object returned by UploadBeforeEvent.getDetailFile()

We are currently in Vaadin 23.1.8, is it possible to use formData.file.size in StartedEvent.getContentLength? or is there any reason you are not doing that? Is there any recommendation for me to overcome this issue? I know I could store the file to disk and then send it to the legacy system but it does not seem right.