Skip to content

Revision value is calculated as MD5 hash of file path, not file contents #22

@drub0y

Description

@drub0y

The following logic is currently used to calculate the value for revision when building the list of additionalManifestEntries that is passed down into the Workbox Webpack Plugin:

const getRevision = (file) =>
crypto.createHash("md5").update(Buffer.from(file)).digest("hex");

Unfortunately, file in this case is a relative file URL and not the actual contents of the file. This means that the MD5 hash that is being calculated is for a string such as "public/android-chrome-192x192.png" and not the actual binary contents of the file. This means that if the contents of the file changes it will never actually be recognized by the next version of the app and the older version will continue to be served out of the service worker's cache.

For this plugin to actually work correctly for the static files, it would actually have to read the contents of the file and get the MD5 hash for the actual contents to use as the revision. Otherwise, the only thing it seems to actually be doing right now for is picking up on new or renamed files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions