Skip to content

added solution#467

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

added solution#467
yahohulia wants to merge 3 commits intomate-academy:masterfrom
yahohulia:develop

Conversation

@yahohulia
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

Great work on setting up the server and using URLSearchParams to handle the query parameters!

This submission requires changes because the logic for parsing the URL pathname does not correctly handle double slashes, which is a core requirement. For example, a path like //hello/world is not being parsed into ['hello', 'world'] as expected.

A more robust approach is to always split the pathname by / and then filter out any empty strings from the resulting array. This single strategy will correctly handle all cases, including single slashes, double slashes, and slashes at the beginning or end of the path. After you adjust this logic, the server should meet all the requirements.


✨ 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

Comment on lines +20 to +24
if (urlArguments[0].includes('//')) {
parts = urlArguments[0].slice(1).split('//');
} else {
parts = urlArguments[0].slice(1).split('/');
}
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 logic for handling double slashes doesn't cover all cases correctly. For example, a path like //hello/world/123 will be incorrectly parsed into ['', 'hello/world/123'] instead of the required ['hello', 'world', '123'].

A more reliable approach is to split the pathname by / and then filter out any empty string elements from the resulting array. This single strategy will correctly handle single slashes, double slashes, and slashes at the beginning or end of the path.

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 implementing the query parameter parsing! That part works perfectly. However, the logic for handling the URL pathname still needs some work as it doesn't handle all the required cases. For example, a path like //hello/world is incorrectly parsed as ['hello/world'] instead of the expected ['hello', 'world']. The current if/else logic is a bit complex and misses this case. A more robust solution, as suggested previously, is to split the pathname by / and then filter out any empty strings from the resulting array. This will correctly handle all variations of slashes (leading, trailing, and double). Keep up the great work, you're almost there!


✨ 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

Comment on lines +20 to +24
if (urlArguments[0].includes('//')) {
parts = urlArguments[0].slice(2).split('//');
} else {
parts = urlArguments[0].slice(1).split('/');
}
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 logic for handling pathname parsing is not yet correct. It fails on several cases required by the task, for example, a path like //hello/world will result in ['hello/world'] instead of ['hello', 'world'].

A more robust approach that handles all cases (leading slashes, double slashes, trailing slashes) is to split the path by / and then filter out any resulting empty strings.

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 iteration! I'm approving your solution as it now perfectly handles all the requirements. Your updated logic for parsing the URL pathname using split and filter is robust and correctly handles all edge cases, including leading and double slashes. The query parameter parsing is also spot-on. The entire implementation is clean, efficient, and fully meets the task specifications. Well done!


✨ 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