Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add digest to .unminified.js and .js.map files #347

Open
codeconsole opened this issue Sep 4, 2024 · 0 comments
Open

Add digest to .unminified.js and .js.map files #347

codeconsole opened this issue Sep 4, 2024 · 0 comments

Comments

@codeconsole
Copy link
Contributor

codeconsole commented Sep 4, 2024

I am not 100% sure the intent behind adding the digest to the filenames, but the behavior is inconsistent. If the intent is resolve caching issues, then the same information should be added to the unminified.js and .js.map files as staging a release would be problematic due to unminified code not matching what was previously released.

 % unzip -l build/libs/website-0.1.jar|grep application\.

     1305  09-04-2024 03:52   BOOT-INF/classes/application.yml
   199738  09-04-2024 03:52   assets/application-94d755824f9fd3be4ad4cd53e37775b6.js
   459392  09-04-2024 03:52   assets/application.js.map
    62827  09-04-2024 03:52   assets/application.js.gz
    30077  09-04-2024 03:52   assets/application.css.gz
   199339  09-04-2024 03:52   assets/application.css
   199339  09-04-2024 03:52   assets/application-f7348fae76fafd153f861913f2bcb41f.css
    30077  09-04-2024 03:52   assets/application-f7348fae76fafd153f861913f2bcb41f.css.gz
    62827  09-04-2024 03:52   assets/application-94d755824f9fd3be4ad4cd53e37775b6.js.gz
   199738  09-04-2024 03:52   assets/application.js
   338386  09-04-2024 03:52   assets/application.unminified.js

Also it would be very useful if the digest in the filename matched the digest of the actual file to verify authenticity.

% md5 jar/assets/bootstrap-0ea926944ea033f05df0ba7b1a12cf24.css

MD5 (jar/assets/bootstrap-0ea926944ea033f05df0ba7b1a12cf24.css) = 2085b9730e0e98f4f61f7e55f3a02cd1

% groovy -e "print java.security.MessageDigest.getInstance('MD5').digest(new File(args[0]).bytes).encodeHex()"
"jar/assets/bootstrap-0ea926944ea033f05df0ba7b1a12cf24.css"

2085b9730e0e98f4f61f7e55f3a02cd1

% aws s3api head-object --bucket MY-BUCKET --key assets/bootstrap-0ea926944ea033f05df0ba7b1a12cf24.css --query ETag --output text

"2085b9730e0e98f4f61f7e55f3a02cd1"

@codeconsole codeconsole changed the title Unminified and source maps missing digest info Add digest to .unminified.js and .js.map files Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant