Skip to content

Commit

Permalink
Change for...of to for...in (#1744)
Browse files Browse the repository at this point in the history
At the busboy.on('finish') event, looping the uploads object with for...of will throw a "uploads is not iterable" error because for...of does not work on objects. The correct for-loop to use here will be for...in
  • Loading branch information
Baystef committed Apr 24, 2020
1 parent 0270a10 commit 45b32ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ exports.uploadFile = (req, res) => {
await Promise.all(fileWrites);

// TODO(developer): Process saved files here
for (const file of uploads) {
fs.unlinkSync(file);
for (const file in uploads) {
fs.unlinkSync(uploads[file]);
}
res.send();
});
Expand Down

0 comments on commit 45b32ee

Please sign in to comment.