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

Commit

Permalink
fix(prefetch): fall back to the _integrity in the manifest if none ca…
Browse files Browse the repository at this point in the history
…lculated
  • Loading branch information
zkat committed Apr 13, 2017
1 parent 9f54863 commit 083ac79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion prefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ function prefetchByManifest (start, spec, opts) {
return finished(stream)
}).then(() => {
opts.log.verbose('prefetch', `${spec} done in ${Date.now() - start}ms`)
return {manifest, spec, integrity, byDigest: false}
return {
manifest,
spec,
integrity: integrity || manifest._integrity,
byDigest: false
}
})
}
4 changes: 2 additions & 2 deletions test/prefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test('prefetch by manifest if no integrity hash', t => {
t.equal(srv.isDone(), true)
t.deepEqual(info, {
byDigest: false,
integrity: null, // not previously cached, so no integrity
integrity: BASE._integrity,
manifest: BASE,
spec: 'foo@1.0.0'
}, 'fresh fetch info returned')
Expand Down Expand Up @@ -127,7 +127,7 @@ test('prefetch by manifest if digest provided but no cache content found', t =>
return prefetch('foo@1.0.0', OPTS).then(info => {
t.deepEqual(info, {
byDigest: false,
integrity: null, // not already cached, so no integrity
integrity: BASE._integrity,
manifest: BASE,
spec: 'foo@1.0.0'
}, 'fresh fetch info returned')
Expand Down

0 comments on commit 083ac79

Please sign in to comment.