diff options
author | regnat <rg@regnat.ovh> | 2020-10-20 15:03:54 +0200 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2020-12-15 09:38:19 +0100 |
commit | 44c3fbc6e03ec518f6174c2b7c21b603973beb91 (patch) | |
tree | a13e4323971b88af7fb3001e0cd2cef39b39b09f | |
parent | f2f60bf5d6c95453f89e47e01fe0bd6a7fdc85bb (diff) |
Fix `addTextToStore` for binary caches
Because of a too eager refactoring, `addTextToStore` used to throw an
error because the input wasn't a valid nar.
Partially revert that refactoring to wrap the text into a proper nar
(using `dumpString`) to make this method work again
-rw-r--r-- | src/libstore/binary-cache-store.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 5b081c1ae..94c11355f 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -433,7 +433,9 @@ StorePath BinaryCacheStore::addTextToStore(const string & name, const string & s if (!repair && isValidPath(path)) return path; - auto source = StringSource { s }; + StringSink sink; + dumpString(s, sink); + auto source = StringSource { *sink.s }; return addToStoreCommon(source, repair, CheckSigs, [&](HashResult nar) { ValidPathInfo info { path, nar.first }; info.narSize = nar.second; |