Skip to content

Commit 6700a5e

Browse files
maxbbraunjmdobry
authored andcommitted
Fix uploaded/updated logic for Cloud Storage (#400)
1 parent 4d69c53 commit 6700a5e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

functions/helloworld/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ exports.helloGCS = function (event, callback) {
9999

100100
if (file.resourceState === 'not_exists') {
101101
console.log(`File ${file.name} deleted.`);
102-
} else if (file.metageneration === 1) {
102+
} else if (file.metageneration === '1') {
103103
// metageneration attribute is updated on metadata changes.
104104
// on create value is 1
105105
console.log(`File ${file.name} uploaded.`);

functions/helloworld/test/index.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ test.serial(`helloGCS: should print uploaded message`, (t) => {
143143
data: {
144144
name: `foo`,
145145
resourceState: `exists`,
146-
metageneration: 1
146+
metageneration: `1`
147147
}
148148
}, callback);
149149

@@ -161,7 +161,7 @@ test.serial(`helloGCS: should print metadata updated message`, (t) => {
161161
data: {
162162
name: `foo`,
163163
resourceState: `exists`,
164-
metageneration: 2
164+
metageneration: `2`
165165
}
166166
}, callback);
167167

0 commit comments

Comments
 (0)