Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

After verifying the cache, the size parameter isn't added when the index is re-built #130

Closed
jfmartinez opened this issue May 7, 2018 · 0 comments

Comments

@jfmartinez
Copy link
Contributor

jfmartinez commented May 7, 2018

Hello!

I noticed, that after the cache is verified the index of the cached item loses the size field.

Here's how to reproduce it:

const cacache = require('cacache');

const data = 'Le test data.';
const cachePath = './tmp-test/';
const key = 'my-key';

async function cacheTest() {
  try {
    await cacache.put(cachePath, key, data);
    const entryBeforeVerify = await cacache.get(cachePath, key);
    console.log(entryBeforeVerify.size);
    await cacache.verify(cachePath);
    const entryAfterVerify = await cacache.get(cachePath, key);
    console.log(entryAfterVerify.size);
  } catch (e) {
    console.error(e);
  }
}
cacheTest();

Details:

  • Node v8.9.4
  • npm v5.6.0
  • cacache v11.0.1

If I'm not mistaken, looks like it should be fixed here: https://github.com/zkat/cacache/blob/latest/lib/verify.js#L197

I can open a PR and fix it and add a test as well if thats OK with you.

jfmartinez added a commit to jfmartinez/cacache that referenced this issue May 7, 2018
Fixes a bug were after the cache was verified the 'size' parameter was
lost from the index of the entry.

Fixes: zkat#130
@zkat zkat closed this as completed in #131 May 7, 2018
zkat pushed a commit that referenced this issue May 7, 2018
Fixes a bug were after the cache was verified the 'size' parameter was
lost from the index of the entry.

Fixes: #130
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant