Skip to content

Added solution to the task#341

Open
YevheniiKa wants to merge 3 commits intomate-academy:masterfrom
YevheniiKa:develop
Open

Added solution to the task#341
YevheniiKa wants to merge 3 commits intomate-academy:masterfrom
YevheniiKa:develop

Conversation

@YevheniiKa
Copy link
Copy Markdown

Added solution to the task

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 on the core implementation! The server correctly serves files from the public directory and includes the important security check to prevent directory traversal. However, this requires changes because a few key requirements for handling specific URL paths are not met.

Specifically, your server needs to be updated to handle these cases:

  • Requests to both /file and /file/ should serve the public/index.html file.
  • Any path that does not start with /file/ (and isn't /file) should return a helpful hint message, not 'Invalid path'.

Please adjust your logic to cover these edge cases as described in the task requirements. You're very close to a complete solution!


✨ 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

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

Thanks for your submission. While the core logic for serving files from the public directory is working well, there are a few key requirements that still need to be addressed. I am requesting changes to align the server's behavior with the task specifications.

Here are the main points to focus on:

  1. Root File Handling: Requests to both /file and /file/ should serve the public/index.html file. Currently, they are returning a hint message or an error, respectively.
  2. Invalid Path Hint: For any path that does not start with /file/ (and isn't /file), the server should return a helpful hint message. The current implementation incorrectly returns a 400 Invalid path error.
  3. Test Alignment: The tests in tests/staticFilesServer.test.js should be updated to match these requirements. For instance, the test for /file should assert that it receives the content of index.html.

Please review the requirements again and adjust the logic for these specific routes. Fixing the tests first can be a great way to guide your implementation.


✨ 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

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

I am approving this submission as an educational override to help you progress, as the core issues from the last review are still present. You've done a great job implementing the logic for serving specific files and preventing directory traversal.

The main area to focus on is handling the special routes according to the requirements:

  • Both /file and /file/ should serve the public/index.html file.
  • Any path that does not start with /file/ (and is not /file) should return a helpful hint message, not a 400 Invalid path error.

To guide your fixes, I recommend first updating the tests in tests/staticFilesServer.test.js to assert the correct behavior for these specific cases. You're very close to finishing this task!


✨ 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