-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #135
base: master
Are you sure you want to change the base?
Develop #135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your hard work on this project! While your implementation meets many of the task requirements, there are a few critical issues that need to be addressed to ensure the functionality is correct:
-
HTML Form Issues:
- The
for
attribute in the label should match theid
of the associated input element without a#
symbol. Please changefor="#compressionType"
tofor="compressionType"
. - The file input is missing a
name
attribute, which is essential for the server to correctly identify and process the uploaded file. Please addname="file"
to the input tag. - The form's
action
attribute should specify the method asPOST
to align with the server's expected method for the/compress
endpoint. Please addmethod="post"
to the form tag.
- The
-
Server Code Issues:
- There is a redundant line setting
res.statusCode = 200;
which can cause confusion since the status code is already set earlier. Consider removing this line. - The
compressionType
is being accessed as an array (compressionType[0]
), but it seems to be a string. Please ensure thatcompressionType
is correctly handled as a string, or verify that it is indeed an array and adjust the logic accordingly.
- There is a redundant line setting
Once these issues are resolved, your code will be in great shape! Keep up the great work, and I look forward to seeing your improvements. 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
|
||
if ( | ||
!compressionType || | ||
!Object.keys(compressionTypes).includes(compressionType[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compressionType
is being accessed as an array (compressionType[0]
), but it is likely a string. Ensure that compressionType
is correctly handled as a string, or verify that it is indeed an array and adjust the logic accordingly.
src/createServer.js
Outdated
fs.createWriteStream(filePath + compressedExtension), | ||
); | ||
|
||
res.statusCode = 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting res.statusCode = 200;
here is redundant since the status code is already set earlier (line 110). Consider removing this line to avoid confusion.
src/public/index.html
Outdated
<body> | ||
<h1>Compression App</h1> | ||
<br/> | ||
<form action="http://localhost:5700/compress"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The form's action
attribute should specify the method as POST
to match the server's expected method for the /compress
endpoint. Add method="post"
to the form tag.
src/public/index.html
Outdated
<h1>Compression App</h1> | ||
<br/> | ||
<form action="http://localhost:5700/compress"> | ||
<input type="file" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file input should have a name
attribute to ensure the server can correctly identify and process the uploaded file. Add name="file"
to the input tag.
src/public/index.html
Outdated
<form action="http://localhost:5700/compress"> | ||
<input type="file" /> | ||
<br> | ||
<label for="#compressionType">Select compression type</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The for
attribute in the label should not have a #
symbol. It should match the id
of the associated input element. Change for="#compressionType"
to for="compressionType"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Great job on implementing the server code with the basic functionality for handling file compression requests! 🎉 Your efforts in aligning the HTML form with the server's expectations are evident, and the code now meets the task requirements and constraints. Here are some key points and suggestions for improvement:
-
Compression Type Handling:
- The
compressionType
is currently being accessed as an array (compressionType[0]
), but it should be a string. Ensure thatcompressionType
is correctly handled as a string to maintain proper logic flow.
- The
-
Redundant Status Code Setting:
- The line setting
res.statusCode = 200;
is redundant since the status code is already set earlier. Removing this line will help avoid confusion.
- The line setting
-
File Handling:
- Ensure that the file handling logic correctly checks for the existence of the uploaded file and processes it appropriately.
-
HTML Form Improvements:
- The form's
method
attribute is correctly set topost
, and the file input includes aname
attribute, which is essential for the server to identify and process the uploaded file. - If you add a label element, ensure that the
for
attribute matches theid
of the associated input element.
- The form's
Your implementation aligns well with the task requirements. While there are a few critical issues to address, this decision to approve is made to help you move forward with your learning. Please review the comments to improve your code, and ensure these issues are addressed in the future to avoid similar problems. Keep up the great work and continue learning from your experiences! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
if ( | ||
!compressionType || | ||
!Object.keys(compressionTypes).includes(compressionType[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compressionType
is being accessed as an array (compressionType[0]
), but it should be a string. Ensure that compressionType
is correctly handled as a string.
return; | ||
} | ||
|
||
res.statusCode = 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line setting res.statusCode = 200;
is redundant because the status code is already set earlier. Consider removing this line to avoid confusion.
No description provided.