Closed kevinlu1248 closed 1 year ago
I found the following snippets in your repository. I will now analyze this snippets and come up with a plan.
From looking through the relevant snippets, I decided to make the following modifications:
File Path | Proposed Changes |
---|---|
src/pages/challenges/[slug].jsx |
Add a check after the challenge data is fetched. If the data is not found (i.e., the challenge ID is invalid), redirect to a 404 page. |
I have created a plan for writing the pull request. I am now working on executing my plan and coding the required changes to address this issue. Here is the planned pull request:
Handle Invalid Challenge IDs
sweep/issue-65-handle-invalid-challenge-ids
This PR addresses issue #65.
Previously, entering an invalid challenge ID in the URL would still return the challenge page, but with empty content. This PR changes this behavior to redirect to a 404 page instead.
Changes:
- Added a check in
src/pages/challenges/[slug].jsx
to verify if the challenge data is fetched successfully. If not (i.e., the challenge ID is invalid), it redirects to a 404 page.This ensures a better user experience as users are properly informed when they navigate to a non-existent challenge page.
Please review and let me know if there are any concerns.
I have finished coding the issue. I am now reviewing it for completeness.
Success! 🚀
I'm a bot that handles simple bugs and feature requests but I might make mistakes. Please be kind! Join Our Discord
Entering an invalid challenge ID in the URL still returns the page - but with empty content. It should instead redirect to a 404 page. Replica of https://github.com/ctfguide-tech/CTFGuideNext/issues/61.