@@ -28,16 +28,17 @@ void FirmwareDownloader::downloadLocalFile(FlipperZero *device, const QString &f
2828 enqueueOperation (new Flipper::Zero::FirmwareDownloadOperation (device, file));
2929}
3030
31- void FirmwareDownloader::downloadRemoteFile (FlipperZero *device, const Updates::FileInfo &fileInfo )
31+ void FirmwareDownloader::downloadRemoteFile (FlipperZero *device, const Flipper:: Updates::VersionInfo &versionInfo )
3232{
3333 // TODO: Local cache on hard disk?
34+ const auto fileInfo = versionInfo.fileInfo (QStringLiteral (" full_dfu" ), device->target ());
35+
3436 auto *fetcher = new RemoteFileFetcher (this );
37+ auto *buf = new QBuffer (this );
3538
36- connect (fetcher, &RemoteFileFetcher::finished, this , [=](const QByteArray &data) {
37- auto *buf = new QBuffer (this );
39+ check_return_void (buf->open (QIODevice::ReadWrite), " Failed to create intermediate buffer." );
3840
39- buf->open (QIODevice::ReadWrite);
40- buf->write (data);
41+ connect (fetcher, &RemoteFileFetcher::finished, this , [=]() {
4142 buf->seek (0 );
4243 buf->close ();
4344
@@ -47,7 +48,7 @@ void FirmwareDownloader::downloadRemoteFile(FlipperZero *device, const Updates::
4748 });
4849
4950 device->setStatusMessage (tr (" Fetching the update file..." ));
50- fetcher->fetch (fileInfo);
51+ fetcher->fetch (fileInfo, buf );
5152}
5253
5354void FirmwareDownloader::downloadLocalFUS (FlipperZero *device, const QString &filePath)
0 commit comments