Skip to content

Commit

Permalink
feat: allow loading non gzipped indexes
Browse files Browse the repository at this point in the history
fixes: #4
  • Loading branch information
FlafyDev committed May 29, 2024
1 parent c812267 commit baea0aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/managers/auto_nong_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ void AutoNongManager::loadIndexes() {
.bytes()
.then([this, index](const geode::ByteVector &r) {
std::vector<uint8_t> rVec = r;
std::string jsonString = decompressGz(rVec);
bool isGzip = (rVec.size() > 2) && (rVec[0] == 0x1F) && (rVec[1] == 0x8B);

std::string jsonString;
if (isGzip) {
jsonString = decompressGz(rVec);
} else {
jsonString = std::string(rVec.begin(), rVec.end());
}

matjson::Value jsonObj = matjson::parse(jsonString);

Expand Down

0 comments on commit baea0aa

Please sign in to comment.