File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -419,7 +419,7 @@ export class IDBCache implements AsyncStorage {
419419 const chunk = value . slice ( i , i + this . chunkSize ) ;
420420 const chunkIndex = Math . floor ( i / this . chunkSize ) ;
421421
422- const chunkHash = await computeChunkHash ( chunk ) ;
422+ const chunkHash = await computeChunkHash ( chunk , this . cacheBuster ) ;
423423 const chunkKey = generateChunkKey ( baseKey , chunkIndex , chunkHash ) ;
424424 newChunkKeys . add ( chunkKey ) ;
425425
Original file line number Diff line number Diff line change @@ -56,9 +56,12 @@ export function generateChunkKey(
5656 return `${ baseKey } -chunk-${ String ( chunkIndex ) . padStart ( 6 , "0" ) } -${ chunkHash } ` ;
5757}
5858
59- export async function computeChunkHash ( chunk : string ) : Promise < string > {
59+ export async function computeChunkHash (
60+ chunk : string ,
61+ cacheBuster : string
62+ ) : Promise < string > {
6063 const encoder = new TextEncoder ( ) ;
61- const data = encoder . encode ( chunk ) ;
64+ const data = encoder . encode ( ` ${ cacheBuster } : ${ chunk } ` ) ;
6265 const hashBuffer = await crypto . subtle . digest ( "SHA-512" , data ) ;
6366 const hashArray = Array . from ( new Uint8Array ( hashBuffer ) ) ;
6467 const hashHex = hashArray
You can’t perform that action at this time.
0 commit comments