Open whmountains opened 2 years ago
Patches welcome, or I'll get to this eventually.
I tried to make a patch but got hung up on some limitations of my Java interop knowledge. I went for a temporary fix for now but will be happy to submit a patch if I get one working. Cheers.
@danielcompton I might be missing something, but it seems that checksum-file
works as-is when passed sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream
instance.
It even returned the same checksum value as when the file is passed as a File
instance.
So I think might just work if modifying the check here to also accept JarURLInputStream
or generic InputStream
/FileInputStream
:
Great! I'm happy to take a patch for this.
For someone looking at it in the future, I didn't manage to figure out a way with JarURLInputStream to stream file contents and calculate checksum at the same time. Specifically what I was missing is to be able to "reset" JarURLInputStream after it has been consumed for checksum calculation and return it in result.
I ended up calculating checksum of all static files (js,css,images) during the uberjar build process and storing the sums in a separate file in resources
. Then this file can be used to compare checksums in production.
Files served from an uberjar are instances of
JarURLInputStream
notFile
, therefore no etag is calculated.