Recently, I posted a comment on a question, which contained a relative link to another question on this site (i.e. a link of the form [link](/questions/3122/formatting-sandbox)
). The question was later migrated to Meta Stack Overflow.
Later on, on the migrated question, I received a comment reply from another user asking me why I linked to an answer on that site that was completely unrelated to the thing I was talking about. I was very confused as to why they'd be asking such a question, since I could have sworn that the resource I linked to was at least remotely relevant (if not completely relevant).
After a little investigation, I realized that the domain portion had been rewritten to link to Meta Stack Overflow instead, breaking the link. (The link was correct in that the portion after the site domain was correct.)
This doesn't seem like expected behavior, since the commenter may not be aware of the fact that their question may end up being migrated later and that their relative link would be broken if the question gets migrated. (I was unaware it would be, since normal users can't vote to migrate questions from this site; migration requires a moderator here.)
This might seem like a rather rare occurrence, but given that the SE team has decided to support relative links in other cases, I think this falls under that as well. I often end up with a relative link under the following cases:
- I have the ID of a question memorized
- I sometimes use the duplicate dialog to find links to related questions (without actually voting to close); that spits out relative links
- The comment has a lot of links and would exceed the length limit, but I can shorten it by making links relative (while there are other ways to shorten post URLs, I've hit the length limit even when using all of those)
Also, I believe that this not only applies to comments, but also to posts (the question and any answers) too. (It could be the same if the Markdown is not re-rendered, but if it is, or if the post is rebaked later, it may break.)
Summary: if a question gets migrated, any relative links in the question, answers, and any comments shouldn't become broken links to things on the destination site, but instead remain links to the origin site (as they were back when they were originally posted).
If anyone tries to reproduce this bug for this specific combination of sites, please be sure to use a post ID higher than 250000. Post IDs less than 250000 on Meta Stack Overflow redirect back here, so it may appear to "work" when it actually doesn't (those redirect back here as part of the mso-mse-split).
/a
or/posts
.