Skip to content

Fix occasional crash when downloading assets from the Asset Library

Created by: Calinou

This is caused by GitHub not publishing a Content-Length header in all cases (it only does so if the file was requested recently), which in turn made String.humanize_size() try to humanize a size of -1 byte (as returned by HTTPRequest when no Content-Length is contained in the response). This crashed the editor due to a division by zero.

For some reason, HTTPRequest always returns 0 bytes downloaded if the body size isn't known (even though the download is successful). Therefore, I also hid the number of downloaded bytes if the total file size is unknown. This may hint at a bug in HTTPRequest, which should be fixed separately.

This closes #21200 (closed).

Merge request reports