node_compression#165
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Thank you for your hard work! 😊 However, there is a critical issue with how you access form fields and files from formidable: you are treating them as arrays (using [0]), but formidable returns objects with keys, not arrays. This will cause runtime errors and break the core validation and file processing logic, so the server won't work as required. Please update your code to access fields and files as objects (e.g., fields.compressionType and files.file.filepath) and adjust any related logic accordingly. Once you fix this, your solution should meet all the requirements! Keep going—you’re almost there! 🚀
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| return; | ||
| } | ||
|
|
||
| const inputStream = fs.createReadStream(file[0].filepath); |
There was a problem hiding this comment.
Issue: formidable's files.file is an object, not an array. You should access the file object directly (e.g., files.file.filepath), not with [0]. This will cause a runtime error.
|
|
||
| const file = files.file; | ||
|
|
||
| const compressionType = fields.compressionType; |
There was a problem hiding this comment.
Issue: formidable's fields.compressionType is not necessarily an array. You should access it as a string (e.g., fields.compressionType), not with [0]. This will cause a runtime error.
| let outputStream; | ||
| let extensionChoice = ''; | ||
|
|
||
| switch (compressionType[0]) { |
There was a problem hiding this comment.
Issue: Since compressionType is not an array, you should use switch (compressionType) instead of compressionType[0].
| return; | ||
| } | ||
|
|
||
| const originalFileName = file[0].originalFilename; |
There was a problem hiding this comment.
Issue: Same as above, file[0].originalFilename should be file.originalFilename if you fix the file object access.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job! 🎉 Your implementation meets all the core requirements and functions as expected. The previous critical issue with formidable field/file access has been resolved, and all error handling, compression logic, and response formatting are correct. The only minor point is the presence of an unnecessary .eslintrc.js file, but this does not affect functionality. Keep up the good work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.