Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on setting up the server and using streams with the zlib module. However, this requires changes because a few critical issues are preventing the application from functioning correctly.
Here are the main points to address:
- Broken HTML Form: In
src/index.html, the form is created with a<br>tag instead of a<form>tag. This is a critical issue that prevents the form from submitting any data. - Incorrect File Extensions: In
src/createServer.js, the output file extensions don't match the requirements. They should be.gzfor gzip and.dflfor deflate. - Hanging Request: When a POST request is made to
/compresswith an invalidcontent-type, your server sets the status code to 400 but never sends a response. This causes the client's request to hang and eventually time out.
Please address these points, and I'll be happy to take another look!
✨ 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/index.html
Outdated
| <title>Document</title> | ||
| </head> | ||
| <body> | ||
| <br action="/compress" method="POST" enctype="multipart/form-data"> |
There was a problem hiding this comment.
This should be a <form> tag, not a <br> tag. An HTML form must start with <form> to be able to submit data.
src/index.html
Outdated
| <body> | ||
| <br action="/compress" method="POST" enctype="multipart/form-data"> | ||
| <label for="file">Select file: </label> | ||
| <input type="file" id="file" name="file" require> |
There was a problem hiding this comment.
There's a typo in the attribute here. To make this input field mandatory, the attribute should be required instead of require.
src/index.html
Outdated
| <label for="file">Select file: </label> | ||
| <input type="file" id="file" name="file" require> | ||
|
|
||
| <label for="compressionType">Choose comresion type: </label> |
There was a problem hiding this comment.
There's a typo in the label text. It should be 'compression'.
| <br /> | ||
|
|
||
| <button type="submit">Compress</button> | ||
| </form> |
There was a problem hiding this comment.
This closing </form> tag does not have a matching opening <form> tag. This is because a <br> tag was used on line 9 instead.
src/createServer.js
Outdated
| if (!contentType || !contentType.includes('multipart/form-data')) { | ||
| res.statusCode = 400; | ||
|
|
||
| return; |
There was a problem hiding this comment.
When the content-type is invalid, you set the status code but never send a response back to the client. This will cause the request to hang. Consider using your sendStatus helper function here to ensure a response is sent.
|
|
||
| if (compressionType === 'gzip') { | ||
| compressor = zlib.createGzip(); | ||
| extension = '.gzip'; |
There was a problem hiding this comment.
The task requirement specifies the file extension for gzip compression should be .gz.
|
|
||
| if (compressionType === 'deflate') { | ||
| compressor = zlib.createDeflate(); | ||
| extension = '.deflate'; |
There was a problem hiding this comment.
According to the task description, the file extension for deflate compression should be .dfl.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great progress on this iteration! You've successfully fixed the broken HTML form and resolved the hanging request issue. However, this requires changes because a critical requirement regarding file extensions is still not met, which was also pointed out in the previous review.
In src/createServer.js, the server is generating incorrect file extensions for compressed files:
- For
gzipcompression, the extension should be.gz, not.gzip. - For
deflatecompression, the extension should be.dfl, not.deflate.
Please update your code to ensure the output files have the correct extensions as specified in the task description. This is the only remaining blocker!
✨ 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
|
|
||
| if (compressionType === 'gzip') { | ||
| compressor = zlib.createGzip(); | ||
| extension = '.gzip'; |
There was a problem hiding this comment.
The requirement specifies the extension for gzip should be .gz, not .gzip.
|
|
||
| if (compressionType === 'deflate') { | ||
| compressor = zlib.createDeflate(); | ||
| extension = '.deflate'; |
There was a problem hiding this comment.
According to the task description, the extension for deflate should be .dfl.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution as an educational override to help you progress, but please note there's one last detail to correct. You've built a solid server that correctly handles routing, status codes, and the streaming pipeline! The only remaining issue is in src/createServer.js: the file extensions for compression are incorrect. Please update them to use .gz for gzip and .dfl for deflate to fully align with the task requirements. Great job overall!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| if (compressionType === 'gzip') { | ||
| compressor = zlib.createGzip(); | ||
| extension = '.gzip'; |
There was a problem hiding this comment.
The file extension for gzip compression is still incorrect. According to the task description, it should be .gz.
|
|
||
| if (compressionType === 'deflate') { | ||
| compressor = zlib.createDeflate(); | ||
| extension = '.deflate'; |
There was a problem hiding this comment.
The file extension for deflate compression also needs to be corrected. The requirement specifies using .dfl for this compression type.
Compression App