Open JamesMcMahon opened 9 years ago
Yes you are right. You will have to flush the cache file we could create a hash for the headers and append it to the filename to make it more bullet proof If you have some time feel free to hack on it and send a PR
On Fri, Jun 19, 2015 at 10:54 AM, James F McMahon notifications@github.com wrote:
When changing headers on objects the files are not republished if passed through cache().
Might be doing something wrong but it seems like this is an omission with the current behavior. Thoughts?
— Reply to this email directly or view it on GitHub https://github.com/pgherveou/gulp-awspublish/issues/73.
PG
Thanks for the answer. If I get a chance I will take a look. For now I will just disable cache()
in my personal project to avoid this issue.
For now consider this an open feature request.
:+1: I ran into this today. It appears to not work regardless of using cache()
since the S3 and local ETag are compared and if they're equivalent, the state of the file is set to skip
. My only workaround is to use the force
option.
From my quick look it looks like the following needs to be done:
skip
state.@pgherveou Can you confirm this? I may be able to hack a PR together... but my experience with gulp plugins is limited :smile:.
yes I think you got it all, you can add an option on the cache stream that specify headers to be checked, (or just a boolean depending of your needs)
the cache file could look like that and you would compare all keys with the file in the stream
{
"<file.s3.path>": {
"etag": file.s3.etag,
"header1": "header1 value",
"header2": "header2 value"
}
}
Hi, why don't you hash all headers in a single cache key? I came with the same issue and because I needed a more modularized approach I created https://github.com/yvele/poosh it's working nicely and you can maybe look at it to fix your issue.
Poosh cache file stores 3 separate hash keys for each processed local file:
Each cache file line looks like this:
{
"id":"url",
"c":"c5766b5257229169dfd571088341a817GZ", // content + gzip suffix
"h":"645dac9a", // HTTP headers
"r":"68227929" // specific remote options
}
This is my Poosh function I use to hash headers and remote options: https://github.com/yvele/poosh/blob/master/packages/poosh-core/src/helpers/options/hash.js
When changing headers on objects the files are not republished if passed through
cache()
. For example, changing thecache-control
on an object result in the object being marked as "skipped" during thepublish()
call.Might be doing something wrong but it seems like this is an omission with the current behavior. Thoughts?