Comment 0 for bug 1923313

Revision history for this message
MarkMielke (mark-mielke) wrote :

This is similar to 1775678 and a few others. The code in GlanceImaceService.download() specifies:

with open(parsed_url.path, "r") as f:
    shutil.copyfileobj(f, data)

This code only takes effect if "file" is specified for allowed_direct_url_schemes.

This results in hard to debug character set errors during image download. Luckily, it seems that the image usually fails to download with an obscure error rather than becoming corrupt.

This should have been caught with the move to Python 3. Python 3 requires "rb" when opening binary files. "r" opens in text mode. It may be that allowed_direct_url_scheme is not used by very many people. However, I still use it, and I have been holding onto a local patch ("r" => "rb") since Train which resolves the problem every time. Opening this issue to start the process of getting the fix posted.