This appears to have started breaking in the last four hours or so.
To reproduce:
Do a search for answers on a Stack Exchange site. For the sake of a demonstration I'll use
is:a
on Meta Stack Exchange. It also applies to Stack Overflow - and I imagine all Stack Exchange sites.Click one of the linked answers.
What happens:
- The search correctly displays answers, but the links do not take the page directly to the answer and instead just shows the question.
Taking the answer (post id 342059) to Thank you, Shog9 (the highest-voted answer on Meta Stack Exchange at the moment and therefore the top of the linked search), the URL from the search page is
which, should go to the <a name="342059"></a>
part of the page (i.e. directly to the answer) because it ends with a URI fragment (#342059
).
It does not - instead the URL of the loaded page is (note the dangling ?
at the end and no fragment identifier (#
) at all):
This appears to be due to the query string (?
) interacting with the fragment identifier. Extracting the characters from the ?
to the #
, i.e. ?r=SearchResults&s=1|0.0000
to get the URL:
does work - as expected. Note that this is exactly the same URL that the link to the answer from Shog9's profile page points to (i.e. without the query).
The URLs are broken whichever query fields are in there (either r
or s
) but when I replace the r
and s
fields with anything else (e.g. ?works=true
) to get
it does work. It's like the presence of the r
and s
fields in the query is breaking it. The meanings of the r
and s
fields are explained in this answer by Glorfindel to Documentation for Stack Exchange engine URLs?:
Questions
Note that the presence of the pipe in the s
field doesn't seem to be the culprit since
works.
Reproduced on
- { Firefox 84.0.2, Chrome 84.0.4147.89, Edge 85.0.564.67 } on Windows 10,
- Chrome 87.0.4280.141 on Android 11
both logged in and with private browsing.
This may or may not be related:
For some reason, the URL of the answer changes to add the relevance points (the s
field in the query) when I interact with it in the browser. When I hover over it it's
but when I mouse-down (either left or right button) on the link it changes to add another field (s
) - adding &s=1|0.0000
() to the URL:
This is reflected in the source, which dynamically changes from
<a href="/questions/342031/thank-you-shog9/342059?r=SearchResults#342059"
data-searchsession="/questions/342031/thank-you-shog9/342059?r=SearchResults&s=1|0.0000#342059"
title="Thank you, Shog9"
class="question-hyperlink">A: Thank you, Shog9
</a>
to
<a href="/questions/342031/thank-you-shog9/342059?r=SearchResults&s=1|0.0000#342059"
data-searchsession="/questions/342031/thank-you-shog9/342059?r=SearchResults&s=1|0.0000#342059"
title="Thank you, Shog9"
class="question-hyperlink">A: Thank you, Shog9
</a>
Weird(?)
?
belong to the HTML GET "payload" (not a rhetorical question)? Possibly an invalid format for that payload??r=SearchResults&s=1|0.0000
fixes the bug - but that's not... ideal.#
part ("fragment"?) is, I have now found, supposed to be at the end (after an optional query string part).)|
) character is in the set of unsafe characters for a URL. But does it apply to the query string? Possible experiment: encode|
as%7C
.&
) with the pipe like https://meta.stackexchange.com/questions/342031/thank-you-shog9/342059?r=SearchResults#342059 it still doesn't go to the answer anchor. Weird.