Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on the overall structure of your server! The validation logic is solid, and you've correctly implemented streams with the zlib module.
I'm requesting a few changes because the server is currently generating incorrect file extensions for compressed files. The task requires .gz for gzip and .dfl for deflate, but your code produces .gzip and .deflate. This is a core requirement and is causing the tests to fail.
This issue originates in src/constants.js and affects the filename generation in src/createServer.js. You can fix this by creating a map between the compression method name and the correct file extension. For example, gzip should map to gz. Once this is fixed, your solution should be all set!
✨ 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
src/createServer.js
Outdated
| bb.on('file', (name, file, { filename }) => { | ||
| fileHandled = true; | ||
|
|
||
| const finName = `${filename}.${comp}`; |
There was a problem hiding this comment.
The task description specifies the extensions for compressed files should be .gz for gzip and .dfl for deflate. Currently, you are using the compression method name (comp) directly, which results in .gzip and .deflate. You should create a mapping from the compression method to the correct file extension.
| gzip: 'gzip', | ||
| deflate: 'deflate', |
There was a problem hiding this comment.
According to the task description, the file extensions for gzip and deflate should be .gz and .dfl, respectively. The current values ('gzip', 'deflate') lead to incorrect extensions (.gzip, .deflate) being generated by the server. To fix this, these values should be changed to the correct extensions, similar to how brotli: 'br' is already handled.
| enctype="multipart/form-data" | ||
| > | ||
|
|
There was a problem hiding this comment.
The display text for these options is currently the same as their value. If you update the values to be the required file extensions (e.g., 'gz'), the user will see these short extensions in the dropdown. For better user experience, consider hardcoding the full names (gzip, deflate, brotli) as the display text while using the shorter extensions for the value attribute.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work fixing the file extension issue! The server now correctly generates .gz, .dfl, and .br extensions.
However, a change is needed because there's now a mismatch between the compression types your server expects and what the requirements specify. Your application expects short names like gz, but the requirements and tests use the full names like gzip. This is causing your validation to fail and is the likely reason the tests aren't passing.
To resolve this, please:
- Update the
<option>values in your HTML form to use the full names:gzip,deflate, andbr. - Adjust your validation logic to accept these full names.
- Map the full names to the correct file extensions (e.g.,
gzipmaps to.gz) when you construct the filename increateServer.js.
You're very close to finishing this!
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this iteration! You've successfully addressed all the feedback from the previous review. The form now correctly uses the gzip, deflate, and br compression types, and the server-side logic handles them perfectly. Your implementation now meets all the task requirements. This is a solid submission, and I am happy to approve it. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Tests are failing due to app works a bit different than tests expect