mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
Include compression in the NarInfo JSON format
It was forgotten before.
This commit is contained in:
parent
937e02e7b9
commit
a7212e169b
3 changed files with 7 additions and 0 deletions
|
|
@ -146,6 +146,8 @@ nlohmann::json NarInfo::toJSON(
|
|||
if (includeImpureInfo) {
|
||||
if (!url.empty())
|
||||
jsonObject["url"] = url;
|
||||
if (!compression.empty())
|
||||
jsonObject["compression"] = compression;
|
||||
if (fileHash)
|
||||
jsonObject["downloadHash"] = fileHash->to_string(hashFormat, true);
|
||||
if (fileSize)
|
||||
|
|
@ -168,6 +170,9 @@ NarInfo NarInfo::fromJSON(
|
|||
if (json.contains("url"))
|
||||
res.url = ensureType(valueAt(json, "url"), value_t::string);
|
||||
|
||||
if (json.contains("compression"))
|
||||
res.compression = ensureType(valueAt(json, "compression"), value_t::string);
|
||||
|
||||
if (json.contains("downloadHash"))
|
||||
res.fileHash = Hash::parseAny(
|
||||
static_cast<const std::string &>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue