QByteArray is adding 4 extra bytes when outputting to a file

410 Views Asked by At

I am working on OpenRGB's auto Updates but recently it(Qt) started added extra bytes to the raw file

I am downloading the file with

QByteArray OpenRGBUpdateInfoPage::GetPageSourceOrFile(QString link)
{
    QEventLoop GetPageSourceOrFile;
    QNetworkAccessManager Manager;
    QNetworkRequest RequestSourceOrFile((QUrl(link)));
    QNetworkReply *Reply = Manager.get(RequestSourceOrFile);
    connect(Reply, &QNetworkReply::finished, &GetPageSourceOrFile, &QEventLoop::quit);
    GetPageSourceOrFile.exec();
    QByteArray ReturnInput = Reply->readAll();
    //GetPageSourceOrFile.deleteLater();

    return ReturnInput;
}

and

    QFile ORGBfile(FileStorageLocation);
    ORGBfile.open(QIODevice::WriteOnly);
    QDataStream out(&ORGBfile);
    out << AppBuffer;
    ORGBfile.close();

for writing out to the file

for some reason this issue only occurs on linux

https://gitlab.com/herosilas12/OpenRGB/-/tree/auto-update is the repo

1

There are 1 best solutions below

0
On

It turned out that QFile.write() worked.

AppBuffer Was was the downloaded appimage file (In the desc I mentioned that I was working on auto Updates for OpenRGB)

The issue was that QDataStream adds a size header to the front