incubator-answer icon indicating copy to clipboard operation
incubator-answer copied to clipboard

Infinite Redirect for Edited Question

Open calmdev opened this issue 1 year ago • 7 comments

Describe the bug

I edited a question a few times yesterday and noticed that there is an infinite redirect on refresh.

To Reproduce

  1. Go here: https://godev.com/questions
  2. Find the post titled: How do I get started learning Go?
  3. Click it and notice question loads.
  4. Refresh the page and note an infinite redirect

Also note if you view other questions refreshing the page doesn't have the same redirect issue.

Expected behavior

Refreshing page for an edited question doesn't result in infinite redirect? I haven't had a chance to dig into it more yet. Or compare by editing other posts. Sharing here incase someone has seen it or might have an idea.

Screenshots

https://github.com/apache/incubator-answer/assets/461249/95ff7d28-4e07-4e98-8a56-4865880d761f

Screenshot 2024-03-27 at 2 36 17 PM

Platform

  • Device: Mac Book Air, 2022
  • OS: MacOS Sonoma 14.4
  • Browser and version: Brave – Version 1.64.109 Chromium: 123.0.6312.58 (Official Build) (arm64)
  • Version: 1.20

calmdev avatar Mar 27 '24 18:03 calmdev

FWIW, I just made a couple edits on this post as well and it seems fine: https://godev.com/questions/10010000000000231/alternate-of-io-readall

Still not exactly sure what's different about the one in my video and original post.

calmdev avatar Mar 27 '24 22:03 calmdev

@calmdev Thank you very much for your feedback. We have found the cause and are checking to see if there are other similar issues. Furthermore, we will fix this issue ASAP.

LinkinStars avatar Mar 28 '24 02:03 LinkinStars

Awesome, I'll keep an eye out for the patch.

calmdev avatar Mar 28 '24 02:03 calmdev

@LinkinStars

hmmm... very interesting bug. what is the issue?

zahash avatar Apr 05 '24 18:04 zahash

@LinkinStars

hmmm... very interesting bug. what is the issue?

@zahash This is caused by the fact that there is a question mark(?) in the title of the question. So, I'm still testing to see if there are any other special characters that could cause this problem. 🧐

The loop is

/questions/:questionID/:questionTitle -> /questions/:questionID/:questionTitle/:answerID(not exist) -> /questions/:questionID/:questionTitle

Because the /questions/:questionID/:answerID is also a correct path. We need to identify if the questionTitle is a title or answerID. In this circumstances, It's a parsing error.

LinkinStars avatar Apr 06 '24 03:04 LinkinStars

Are there specific steps or sequence of actions required to cause it?

I still haven't seen it for any other questions with (?) in the title.

In the video & screenshot what is the second id in path that is append to URL – a revision number or something?

calmdev avatar Apr 06 '24 14:04 calmdev

Are there specific steps or sequence of actions required to cause it?

I still haven't seen it for any other questions with (?) in the title.

https://github.com/apache/incubator-answer/commit/58dd97ac2a6f5b17fd767aefff7e452cb10261c4

It's probably not just the special symbols that causes this problem. My final solution was to make sure that the correct answer ID must exist.

In the video & screenshot what is the second id in path that is append to URL – a revision number or something?

This is the wrong AnswerID that lead to the infinite redirect.

LinkinStars avatar Apr 07 '24 04:04 LinkinStars