Skip to content

solution#211

Open
IvanKovalyoff wants to merge 5 commits intomate-academy:masterfrom
IvanKovalyoff:develop
Open

solution#211
IvanKovalyoff wants to merge 5 commits intomate-academy:masterfrom
IvanKovalyoff:develop

Conversation

@IvanKovalyoff
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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

This is a strong submission that correctly implements most of the server logic, including routing and stream-based compression. Great job on that! However, one change is required before this can be approved. The way the compressed filename is constructed doesn't fully meet the requirements. Currently, it produces extensions like .gzip and .deflate, but the task specifies .gz and .dfl respectively. You can fix this in src/createServer.js by mapping the compression type to the correct extension. Also, a minor typo (reqiered instead of required) was found in src/public/index.html. Correcting the file extension logic is the main blocker here. You're very close!


✨ 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

}

const fileName = file.originalFilename;
const compressedFileName = `${fileName}.${compressionType}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the compressed filename is constructed doesn't fully align with the task requirements. The requirement specifies extensions .gz for gzip, .dfl for deflate, and .br for br. This implementation uses the compressionType value directly, which results in incorrect extensions like .gzip and .deflate. You should create a mapping between the compression type and its corresponding extension to generate the correct filename.

<form action="/compress" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="file">Select File:</label>
<input type="file" name="file" id="file" reqiered>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the required attribute. It should be spelled required for the browser to enforce that a file must be selected before submitting the form.

Copy link
Copy Markdown

@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 fixing the typo in the HTML file! The server logic for routing and error handling is looking solid.

However, this requires changes because the main requirement for filename extensions hasn't been met yet. Currently, the server creates files like file.txt.gzip instead of the required file.txt.gz. This is happening in src/createServer.js where the compressionType is used directly to build the filename.

To fix this, you'll need to map the compression types to their correct extensions (e.g., 'gzip' to '.gz' and 'deflate' to '.dfl'). An object or a switch statement would be a great way to handle this. You're very close to completing the task!


✨ 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

}

const fileName = file.originalFilename;
const compressedFileName = `${fileName}.${compressionType}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line still doesn't produce the correct file extensions as required by the task. For a compressionType of 'gzip', the extension should be .gz, and for 'deflate', it should be .dfl. Currently, this will result in filenames like file.txt.gzip. Consider creating a map or a switch statement to associate the compression type with the correct extension string.

Copy link
Copy Markdown

@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

Excellent work on this submission! I am approving your solution as you've perfectly addressed all the feedback from the previous review and met every requirement. Your use of Maps to handle the different compression types and their corresponding extensions is a very clean and effective approach. The server logic is robust, handling all success and error cases correctly, and the core requirement of using streams for compression is implemented perfectly. Great job!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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