Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20b7e46

Browse files
authored
refactor: update cache-control for avatar (#204)
This change updates cache-control for avatar before uploading.
1 parent 1dbcd6f commit 20b7e46

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fields/types/gcsavatar/GcsAvatarType.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ gcsavatar.prototype.updateItem = function(item, data, callback) {
231231

232232
gcsavatar.prototype.uploadFile = function(item, file, update, callback) {
233233
const _this = this;
234-
const ONE_YEAR = 60 * 60 * 24 * 365;
235234
const publicRead = _this.options.publicRead ? _this.options.publicRead : false;
236235

237236
// Assign filename with email, and non-alphanumeric characters truncated.
@@ -272,7 +271,7 @@ gcsavatar.prototype.uploadFile = function(item, file, update, callback) {
272271
destination: gcsDir + filename,
273272
filetype: filetype,
274273
publicRead: publicRead,
275-
cacheControl: 'public, max-age=' + ONE_YEAR,
274+
cacheControl: 'public, max-age= 60, must-revalidate'
276275
}).then(function() {
277276
const imageData = {
278277
filepath: file.path,

0 commit comments

Comments
 (0)