PICARD-2919: fix download of GIF images (and maybe others)

Issue is the data downloaded is QtCore.QBytesArray object, and it wasn't convert to bytes.
So ensure it is converted before passing it to image detection methods.
This commit is contained in:
Laurent Monin
2024-06-01 16:01:49 +02:00
parent 7492d608bc
commit aad152ddf8

View File

@@ -558,12 +558,13 @@ class WebService(QtCore.QObject):
log.debug("Response received: %s", document) log.debug("Response received: %s", document)
except Exception as e: except Exception as e:
log.error("Unable to parse the response for %s -> %s", display_reply_url, e) log.error("Unable to parse the response for %s -> %s", display_reply_url, e)
document = reply.readAll() document = bytes(reply.readAll())
error = e error = e
finally: finally:
handler(document, reply, error) handler(document, reply, error)
else: else:
handler(reply.readAll(), reply, error) # readAll() returns QtCore.QByteArray, so convert to bytes
handler(bytes(reply.readAll()), reply, error)
ratecontrol.adjust(hostkey, slow_down) ratecontrol.adjust(hostkey, slow_down)