Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

NazariiAlieksieiev
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. HTML Form Issues:

    • The for attribute in the label should match the id of the associated input element without a # symbol. Please change for="#compressionType" to for="compressionType".
    • The file input is missing a name attribute, which is essential for the server to correctly identify and process the uploaded file. Please add name="file" to the input tag.
    • The form's action attribute should specify the method as POST to align with the server's expected method for the /compress endpoint. Please add method="post" to the form tag.
  2. 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 that compressionType is correctly handled as a string, or verify that it is indeed an array and adjust the logic accordingly.

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])

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.

fs.createWriteStream(filePath + compressedExtension),
);

res.statusCode = 200;

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.

<body>
<h1>Compression App</h1>
<br/>
<form action="http://localhost:5700/compress">

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.

<h1>Compression App</h1>
<br/>
<form action="http://localhost:5700/compress">
<input type="file" />

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.

<form action="http://localhost:5700/compress">
<input type="file" />
<br>
<label for="#compressionType">Select compression type</label>

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".

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. Compression Type Handling:

    • The compressionType is currently being accessed as an array (compressionType[0]), but it should be a string. Ensure that compressionType is correctly handled as a string to maintain proper logic flow.
  2. 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.
  3. File Handling:

    • Ensure that the file handling logic correctly checks for the existence of the uploaded file and processes it appropriately.
  4. HTML Form Improvements:

    • The form's method attribute is correctly set to post, and the file input includes a name 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 the id of the associated input element.

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])

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;

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants